fix login redirect
This commit is contained in:
parent
98f612774c
commit
df95f2a01c
4 changed files with 18 additions and 2 deletions
|
@ -8,7 +8,7 @@ const fileRequest = async (url, file, method) => {
|
|||
headers: {}
|
||||
});
|
||||
if (response.status == 401) {
|
||||
location.href = 'login'
|
||||
location.href = '/login'
|
||||
}
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (contentType && contentType.indexOf("application/json") !== -1) {
|
||||
|
@ -31,7 +31,7 @@ const request = async (url, body, method) => {
|
|||
}
|
||||
});
|
||||
if (response.status == 401) {
|
||||
location.href = 'login'
|
||||
location.href = '/login'
|
||||
}
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (contentType && contentType.indexOf("application/json") !== -1) {
|
||||
|
|
|
@ -141,6 +141,12 @@ async function init() {
|
|||
}
|
||||
|
||||
data.self = request.json
|
||||
|
||||
if (request.json == undefined) {
|
||||
location.href = '/login'
|
||||
return
|
||||
}
|
||||
|
||||
data.users[data.self.user_id] = data.self
|
||||
|
||||
const posts = await load()
|
||||
|
|
|
@ -75,6 +75,11 @@ async function init() {
|
|||
throw new Error("Rate limited");
|
||||
}
|
||||
|
||||
if (request.json == undefined) {
|
||||
location.href = '/login'
|
||||
return
|
||||
}
|
||||
|
||||
data.self = request.json
|
||||
|
||||
const users = await load()
|
||||
|
|
|
@ -245,6 +245,11 @@ async function init() {
|
|||
throw new Error("Rate limited");
|
||||
}
|
||||
|
||||
if (request.json == undefined) {
|
||||
location.href = '/login'
|
||||
return
|
||||
}
|
||||
|
||||
data.self = request.json;
|
||||
data.users[data.self.user_id] = data.self
|
||||
|
||||
|
|
Loading…
Reference in a new issue