Skip to content

Commit

Permalink
fix: 버그수정
Browse files Browse the repository at this point in the history
  • Loading branch information
in-jun committed Oct 4, 2024
1 parent cc25de0 commit adee9f4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
}
const activeClass = isActive ? (type === 'like' ? 'liked' : type === 'dislike' ? 'disliked' : 'active') : '';
return `
<button class="action-button ${activeClass}" onclick="handleAction(() => { ${onclick} })">
<button class="action-button ${activeClass}" onclick="handleAction(() => { ${onclick}; getComments(); })">
${getSvgIcon(type)}
${count ? `<span>${count}</span>` : ''}
</button>
Expand Down Expand Up @@ -300,10 +300,16 @@
button.classList.add('processing');

debounce(() => {
action().finally(() => {
const result = action();
if (result && typeof result.then === 'function') {
result.finally(() => {
isProcessing = false;
button.classList.remove('processing');
});
} else {
isProcessing = false;
button.classList.remove('processing');
});
}
}, debounceDelay)();
}

Expand Down Expand Up @@ -339,8 +345,6 @@
const data = await response.json();
if (data.error) {
alert("Error: " + data.error);
} else {
getComments();
}
} catch (error) {
console.error('Error:', error);
Expand Down Expand Up @@ -384,7 +388,6 @@
.then(response => response.json())
.then(data => {
alert(data.message);
getComments();
})
.catch(error => {
console.error('Error:', error);
Expand Down

0 comments on commit adee9f4

Please sign in to comment.