1
0
Fork 0
mirror of synced 2024-06-28 19:10:33 +12:00

Allowing self endpoints to 403 and not reload page.

This commit is contained in:
mike12345567 2021-06-22 16:54:25 +01:00
parent 89c46873af
commit 559e91ec29
2 changed files with 6 additions and 2 deletions

View file

@ -15,7 +15,9 @@ const apiCall =
if (resp.status === 403) {
removeCookie(Cookies.Auth)
// reload after removing cookie, go to login
location.reload()
if (!url.includes("self")) {
location.reload()
}
}
return resp
}

View file

@ -44,7 +44,9 @@ const makeApiCall = async ({ method, url, body, json = true }) => {
return handleError(`${url}: Bad Request`)
case 403:
// reload the page incase the token has expired
location.reload()
if (!url.includes("self")) {
location.reload()
}
return handleError(`${url}: Forbidden`)
default:
if (response.status >= 200 && response.status < 400) {