diff --git a/src/core/features/course/pages/preview/preview.page.ts b/src/core/features/course/pages/preview/preview.page.ts index 5b2dfc9c2..f235d620e 100644 --- a/src/core/features/course/pages/preview/preview.page.ts +++ b/src/core/features/course/pages/preview/preview.page.ts @@ -331,7 +331,7 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy { // Sometimes the list of enrolled courses takes a while to be updated. Wait for it. await this.waitForEnrolled(true); - this.refreshData().finally(() => { + await this.refreshData().finally(() => { // My courses have been updated, trigger event. CoreEvents.trigger(CoreCoursesProvider.EVENT_MY_COURSES_UPDATED, { courseId: this.course!.id, @@ -340,6 +340,8 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy { }, CoreSites.getCurrentSiteId()); }); + this.openCourse(); + modal?.dismiss(); } catch (error) { modal?.dismiss(); @@ -422,7 +424,7 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy { } try { - CoreCourses.getUserCourse(this.course!.id); + await CoreCourses.getUserCourse(this.course!.id); } catch { // Not enrolled, wait a bit and try again. if (this.pageDestroyed || (Date.now() - this.waitStart > 60000)) {