1
0
Fork 0
mirror of synced 2024-09-29 08:41:16 +13:00

adds catch-all notification to some requests that aren't caught in the API

This commit is contained in:
Keviin Åberg Kultalahti 2021-01-25 13:10:13 +01:00
parent 737c9fe52f
commit 20e6279ee1
2 changed files with 4 additions and 0 deletions

View file

@ -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) {

View file

@ -1,3 +1,4 @@
import { notificationStore } from "../store/notification"
import API from "./api"
/**