From b64b1642360093057b0543fd39df951fc75d6461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Mon, 25 Jan 2021 13:10:13 +0100 Subject: [PATCH] adds catch-all notification to some requests that aren't caught in the API --- packages/client/src/api/api.js | 3 +++ packages/client/src/api/queries.js | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/client/src/api/api.js b/packages/client/src/api/api.js index 1e73baf602..a88398ed3a 100644 --- a/packages/client/src/api/api.js +++ b/packages/client/src/api/api.js @@ -1,6 +1,7 @@ /** * API cache for cached request responses. */ +import { notificationStore } from "../store/notification" let cache = {} /** @@ -35,10 +36,12 @@ const makeApiCall = async ({ method, url, body, json = true }) => { case 200: return response.json() case 404: + notificationStore.danger("Not found") return handleError(`${url}: Not Found`) case 400: return handleError(`${url}: Bad Request`) case 403: + notificationStore.danger("Forbidden") return handleError(`${url}: Forbidden`) default: if (response.status >= 200 && response.status < 400) { diff --git a/packages/client/src/api/queries.js b/packages/client/src/api/queries.js index 27c2d2f5ab..dd9996b25a 100644 --- a/packages/client/src/api/queries.js +++ b/packages/client/src/api/queries.js @@ -1,3 +1,4 @@ +import { notificationStore } from "../store/notification" import API from "./api" /**