summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/js/api.js4
-rw-r--r--public/js/home.js6
-rw-r--r--public/js/people.js5
-rw-r--r--public/js/profile.js5
4 files changed, 18 insertions, 2 deletions
diff --git a/public/js/api.js b/public/js/api.js
index 7d9598d..176ae59 100644
--- a/public/js/api.js
+++ b/public/js/api.js
@@ -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) {
diff --git a/public/js/home.js b/public/js/home.js
index 25fe0e9..edc6823 100644
--- a/public/js/home.js
+++ b/public/js/home.js
@@ -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()
diff --git a/public/js/people.js b/public/js/people.js
index be0c988..9b7ba46 100644
--- a/public/js/people.js
+++ b/public/js/people.js
@@ -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()
diff --git a/public/js/profile.js b/public/js/profile.js
index 8322ef0..dd5216d 100644
--- a/public/js/profile.js
+++ b/public/js/profile.js
@@ -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