Saves the quiz locally when calling the saveQuiz api from the quiz overview

parent 7ce86e10
......@@ -192,7 +192,9 @@ export class QuizOverviewComponent implements OnInit {
});
this.modalService.open(QuizSaveComponent).result.catch(() => {}).then(val => {
if (!val || (val.expiry && new Date(val.expiry).getTime() <= new Date().getTime())) {
if (!val || (
val.expiry && new Date(val.expiry).getTime() <= new Date().getTime()
)) {
return;
}
......@@ -200,6 +202,8 @@ export class QuizOverviewComponent implements OnInit {
this.sessions[index].visibility = val.visibility;
this.sessions[index].description = val.description;
this._isSaving.push(index);
this.storageService.db.Quiz.put(this.sessions[index]);
this.quizApiService.putSavedQuiz(this.sessions[index]).subscribe(() => {
this._isSaving.splice(this._isSaving.indexOf(index), 1);
}, () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment