diff --git a/js/admin.js b/js/admin.js index 90c36aa..bf50279 100644 --- a/js/admin.js +++ b/js/admin.js @@ -270,6 +270,7 @@ export const admin = (() => { storage('likes').clear(); storage('config').clear(); storage('comment').clear(); + storage('session').clear(); } if (!session.isAdmin() || JSON.parse(atob(token.get('token').split('.')[1])).exp < ((new Date()).getTime() / 1000)) { @@ -280,6 +281,7 @@ export const admin = (() => { getUserDetail(); getStatUser(); + comment.setEmpty(); comment.comment(); }; diff --git a/js/app.js b/js/app.js index 8b3efb7..95fdeae 100644 --- a/js/app.js +++ b/js/app.js @@ -10,7 +10,6 @@ import { pagination } from './pagination.js'; document.addEventListener('DOMContentLoaded', () => { audio.init(); theme.check(); - comment.init(); pagination.init(); guest.init(); diff --git a/js/comment.js b/js/comment.js index 31226de..9e9821e 100644 --- a/js/comment.js +++ b/js/comment.js @@ -384,7 +384,7 @@ export const comment = (() => { } }; - const init = () => { + const setEmpty = () => { if (!showHide.has('hidden')) { showHide.set('hidden', []); } @@ -395,7 +395,7 @@ export const comment = (() => { }; return { - init, + setEmpty, cancel, send, edit, diff --git a/js/dashboard.js b/js/dashboard.js index 7f39c4d..204a9cb 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -7,11 +7,10 @@ import { comment } from './comment.js'; import { pagination } from './pagination.js'; document.addEventListener('DOMContentLoaded', () => { + admin.init(); + theme.check(); - comment.init(); pagination.init(); - - admin.init(); window.like = like; window.admin = admin; diff --git a/js/guest.js b/js/guest.js index 98bfbb1..bf73795 100644 --- a/js/guest.js +++ b/js/guest.js @@ -1,7 +1,7 @@ import { util } from './util.js'; import { audio } from './audio.js'; import { theme } from './theme.js'; -import { session } from "./session.js"; +import { session } from './session.js'; import { storage } from './storage.js'; import { confetti } from './confetti.js'; @@ -96,6 +96,7 @@ export const guest = (() => { storage('user').clear(); storage('owns').clear(); storage('likes').clear(); + storage('session').clear(); storage('comment').clear(); storage('tracker').clear(); } diff --git a/js/request.js b/js/request.js index fac2116..df2cd4f 100644 --- a/js/request.js +++ b/js/request.js @@ -1,5 +1,5 @@ -import { dto } from "./dto.js"; -import { session } from "./session.js"; +import { dto } from './dto.js'; +import { session } from './session.js'; export const HTTP_GET = 'GET'; export const HTTP_POST = 'POST'; diff --git a/js/session.js b/js/session.js index 8b84230..cc4770e 100644 --- a/js/session.js +++ b/js/session.js @@ -72,6 +72,7 @@ export const session = (() => { config.set(key, value); } + comment.setEmpty(); await comment.comment(); progress.complete('request'); }).catch(() => {