MOBILE-3567 course: Open course after enrollment

main
Noel De Martin 2021-05-27 10:55:20 +02:00
parent c7068ac04e
commit 5c71174992
1 changed files with 4 additions and 2 deletions

View File

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