From 7e8ae2cabbb3b730dd70c1295926f2705cca7e1a Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Fri, 8 Jan 2021 12:26:51 +1100
Subject: [PATCH] pass through 400 message from the backend to the SPA

---
 src/app/notifications.service.ts | 4 ++++
 src/app/tes.service.ts           | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/app/notifications.service.ts b/src/app/notifications.service.ts
index fe2a805..f4bc2f3 100644
--- a/src/app/notifications.service.ts
+++ b/src/app/notifications.service.ts
@@ -29,6 +29,10 @@ export class NotificationsService {
       this.notify(msg.message);
       return;
     }
+    if (msg.hasOwnProperty('msg')) {
+      this.notify(msg.msg);
+      return;
+    }
     this.msg.next(msg);
     console.log(msg);
   }
diff --git a/src/app/tes.service.ts b/src/app/tes.service.ts
index 972e4e8..9d5857b 100644
--- a/src/app/tes.service.ts
+++ b/src/app/tes.service.ts
@@ -365,6 +365,10 @@ private handleError(error: HttpErrorResponse) {
     this.notifications.notify(error);
     return
   }
+  if (error.hasOwnProperty("status") && error.status == 400) {
+    this.notifications.notify(error);
+    return
+  }
   this.notifications.notify("Your login appears to have expired. Please login again");
   this.authorisationService.updateAgentContents().subscribe((v) => {return});
 }
-- 
GitLab