MOBILE-4287 quiz: Go back when attempt is closed
parent
e9fb8784b7
commit
58b9067803
|
@ -48,6 +48,7 @@ import { CoreForms } from '@singletons/form';
|
||||||
import { CoreDom } from '@singletons/dom';
|
import { CoreDom } from '@singletons/dom';
|
||||||
import { CoreTime } from '@singletons/time';
|
import { CoreTime } from '@singletons/time';
|
||||||
import { CoreDirectivesRegistry } from '@singletons/directives-registry';
|
import { CoreDirectivesRegistry } from '@singletons/directives-registry';
|
||||||
|
import { CoreWSError } from '@classes/errors/wserror';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that allows attempting a quiz.
|
* Page that allows attempting a quiz.
|
||||||
|
@ -433,7 +434,18 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
await this.loadSummary();
|
await this.loadSummary();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorsaveattempt', true);
|
// eslint-disable-next-line promise/catch-or-return
|
||||||
|
CoreDomUtils
|
||||||
|
.showErrorModalDefault(error, 'addon.mod_quiz.errorsaveattempt', true)
|
||||||
|
.then(async alert => {
|
||||||
|
await alert?.onWillDismiss();
|
||||||
|
|
||||||
|
if (error instanceof CoreWSError && error.errorcode === 'attemptalreadyclosed') {
|
||||||
|
CoreNavigator.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
});
|
||||||
} finally {
|
} finally {
|
||||||
modal?.dismiss();
|
modal?.dismiss();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue