Skip to content

Commit

Permalink
fix: null session
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed Dec 4, 2024
1 parent 43669c3 commit 3a0a80a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ export const admin = (() => {
};

const init = () => {
session.init();
user = storage('user');

if (!session.isAdmin()) {
storage('owns').clear();
storage('likes').clear();
Expand All @@ -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;
Expand Down

0 comments on commit 3a0a80a

Please sign in to comment.