From 8520762e8559d6f9d3876ed353b3e07f399c8f68 Mon Sep 17 00:00:00 2001 From: samuelim01 <61283948+samuelim01@users.noreply.github.com> Date: Thu, 14 Nov 2024 01:48:24 +0800 Subject: [PATCH] Fix question page error (#100) * Fix question page error It was using the old error system and was missing a toast for messagingService to serve error messages to user * Fix linting --------- Co-authored-by: LimZiJia --- frontend/src/app/questions/question-dialog.component.ts | 6 +++--- frontend/src/app/questions/questions.component.html | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/questions/question-dialog.component.ts b/frontend/src/app/questions/question-dialog.component.ts index 3d11e7ee1e..43568dbe8e 100644 --- a/frontend/src/app/questions/question-dialog.component.ts +++ b/frontend/src/app/questions/question-dialog.component.ts @@ -130,7 +130,7 @@ export class QuestionDialogComponent implements OnInit { this.questionUpdate.emit(response.data); }, error: (error: HttpErrorResponse) => { - this.errorReceive.emit(error.error.message); + this.errorReceive.emit(error.message); }, complete: () => { this.question = {} as Question; @@ -145,7 +145,7 @@ export class QuestionDialogComponent implements OnInit { this.questionAdd.emit(response.data); }, error: (error: HttpErrorResponse) => { - this.errorReceive.emit('Failed to add new question. ' + error.error.message); + this.errorReceive.emit('Failed to add new question. ' + error.message); }, complete: () => { this.question = {} as Question; @@ -182,7 +182,7 @@ export class QuestionDialogComponent implements OnInit { }, error: (error: HttpErrorResponse) => { this.topics = []; - this.errorReceive.emit('Failed to load topics. ' + error.error.message); + this.errorReceive.emit('Failed to load topics. ' + error.message); }, }); } diff --git a/frontend/src/app/questions/questions.component.html b/frontend/src/app/questions/questions.component.html index bf897793d3..d3d7a54f6c 100644 --- a/frontend/src/app/questions/questions.component.html +++ b/frontend/src/app/questions/questions.component.html @@ -128,3 +128,4 @@

{{ clickedOnQuestion?.title }}

+