Skip to content

Commit

Permalink
fix: init comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed Dec 5, 2024
1 parent 4a89935 commit 61977d4
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions js/guest.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ export const guest = (() => {

const init = () => {
session.init();
comment.init();

countDownDate();
information = storage('information');

Expand All @@ -142,30 +140,20 @@ export const guest = (() => {
}

if ((document.body.getAttribute('data-key') ?? '').length === 0) {
const comment = document.getElementById('comment');
if (comment) {
comment.remove();
}

const nav = document.querySelector('a.nav-link[href="#comment"]');
if (nav) {
const item = nav.closest('li.nav-item');
if (item) {
item.remove();
}
}

document.getElementById('comment')?.remove();
document.querySelector('a.nav-link[href="#comment"]')?.closest('li.nav-item')?.remove();
return;
}

comment.init();
progress.add();
session.guest()
.then((res) => {
if (res.code !== 200) {
return;
}

comment.comment()
return comment.comment()
.then(() => progress.complete('comment'))
.catch(() => progress.invalid('comment'));
});
Expand Down

0 comments on commit 61977d4

Please sign in to comment.