feat: replace raw setInterval polling with shared Poller utility across six frontend modules
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Http } from "./Http.js";
|
||||
import { OptimisticAction } from "./OptimisticAction.js";
|
||||
|
||||
export class ReactionBar {
|
||||
export class ReactionBar extends OptimisticAction {
|
||||
constructor() {
|
||||
super();
|
||||
document.addEventListener("click", (event) => this.onClick(event));
|
||||
}
|
||||
|
||||
@@ -42,12 +43,7 @@ export class ReactionBar {
|
||||
const type = bar.dataset.reactionType;
|
||||
const uid = bar.dataset.reactionUid;
|
||||
const emoji = trigger.dataset.reactionEmoji;
|
||||
try {
|
||||
const result = await Http.sendForm(`/reactions/${type}/${uid}`, { emoji });
|
||||
this.render(bar, result);
|
||||
} catch (error) {
|
||||
console.error("reaction failed", error);
|
||||
}
|
||||
await this.submit(`/reactions/${type}/${uid}`, { emoji }, null, (result) => this.render(bar, result));
|
||||
this.closeAllPalettes();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user