From 3a0a80a15918cb406fe3f348af143e09f4636671 Mon Sep 17 00:00:00 2001 From: dewanakl Date: Wed, 4 Dec 2024 22:35:36 +0700 Subject: [PATCH] fix: null session --- js/admin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/admin.js b/js/admin.js index 0a4bd20..1b9479d 100644 --- a/js/admin.js +++ b/js/admin.js @@ -237,6 +237,9 @@ export const admin = (() => { }; const init = () => { + session.init(); + user = storage('user'); + if (!session.isAdmin()) { storage('owns').clear(); storage('likes').clear(); @@ -246,12 +249,9 @@ export const admin = (() => { storage('information').clear(); } - session.init(); theme.spyTop(); comment.init(); - user = storage('user'); - if (!session.isAdmin() || !session.getToken() || (JSON.parse(atob((session.getToken() ?? '.').split('.')[1])).exp ?? 0) < (Date.now() / 1000)) { bootstrap.Modal.getOrCreateInstance('#loginModal').show(); return;