Allowing self endpoints to 403 and not reload page.
This commit is contained in:
parent
89c46873af
commit
559e91ec29
|
@ -15,8 +15,10 @@ const apiCall =
|
||||||
if (resp.status === 403) {
|
if (resp.status === 403) {
|
||||||
removeCookie(Cookies.Auth)
|
removeCookie(Cookies.Auth)
|
||||||
// reload after removing cookie, go to login
|
// reload after removing cookie, go to login
|
||||||
|
if (!url.includes("self")) {
|
||||||
location.reload()
|
location.reload()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,9 @@ const makeApiCall = async ({ method, url, body, json = true }) => {
|
||||||
return handleError(`${url}: Bad Request`)
|
return handleError(`${url}: Bad Request`)
|
||||||
case 403:
|
case 403:
|
||||||
// reload the page incase the token has expired
|
// reload the page incase the token has expired
|
||||||
|
if (!url.includes("self")) {
|
||||||
location.reload()
|
location.reload()
|
||||||
|
}
|
||||||
return handleError(`${url}: Forbidden`)
|
return handleError(`${url}: Forbidden`)
|
||||||
default:
|
default:
|
||||||
if (response.status >= 200 && response.status < 400) {
|
if (response.status >= 200 && response.status < 400) {
|
||||||
|
|
Loading…
Reference in New Issue