summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-02-13 11:59:00 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-02-13 11:59:00 -0500
commitdf95f2a01c396406fba5bd1771fea433ad35a726 (patch)
tree44074ac1f5e88782afa6f6643ba7145624e42fd3 /public
parentupdate dependicies, fix profile page (diff)
downloadxssbook-df95f2a01c396406fba5bd1771fea433ad35a726.tar.gz
xssbook-df95f2a01c396406fba5bd1771fea433ad35a726.tar.bz2
xssbook-df95f2a01c396406fba5bd1771fea433ad35a726.zip
fix login redirect
Diffstat (limited to 'public')
-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