Browse Source

Allowing self endpoints to 403 and not reload page.

pull/1799/head
mike12345567 5 years ago
parent
commit
7c38150fbb
  1. 4
      packages/builder/src/builderStore/api.js
  2. 4
      packages/client/src/api/api.js

4
packages/builder/src/builderStore/api.js

@ -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
}

4
packages/client/src/api/api.js

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

Loading…
Cancel
Save