From 2f33032d385cdde353c5b99182e3de57c9bb34a5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 22 Feb 2021 14:23:16 +0000 Subject: [PATCH] Adding notifier to API for 401 requests, meaning login has notification on fail. --- packages/client/src/api/api.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/client/src/api/api.js b/packages/client/src/api/api.js index 817f14896c..8b2328c6a2 100644 --- a/packages/client/src/api/api.js +++ b/packages/client/src/api/api.js @@ -1,7 +1,7 @@ /** * API cache for cached request responses. */ -import { notificationStore } from "../store/notification" +import { notificationStore } from "../store" let cache = {} /** @@ -34,6 +34,9 @@ const makeApiCall = async ({ method, url, body, json = true }) => { switch (response.status) { case 200: return response.json() + case 401: + notificationStore.danger("Invalid credentials") + return handleError(`Invalid credentials`) case 404: notificationStore.danger("Not found") return handleError(`${url}: Not Found`)