Redirect to login when not authenticated
This commit is contained in:
parent
9529d2cdc8
commit
0c532fb979
@ -16,6 +16,10 @@ export async function request(method, path, body = null) {
|
|||||||
body: body ? JSON.stringify(body) : undefined,
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
})
|
})
|
||||||
.then(async response => {
|
.then(async response => {
|
||||||
|
if (response.status === 401) {
|
||||||
|
location.href = "/login";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user