Replace window report dialog usages with the TypeScript variant

This commit is contained in:
Andreas Nedbal 2022-01-09 02:16:22 +01:00 committed by Andreas Nedbal
parent ecb079b1d4
commit 0418a67780
5 changed files with 15 additions and 5 deletions

View File

@ -1,7 +1,9 @@
import { reportDialog } from 'utilities/reportDialog';
export function commentReportHandler(event: Event): void {
event.preventDefault();
const button = event.target as HTMLButtonElement;
const commentId = button.dataset.cId;
window['reportDialog']('comment', commentId);
reportDialog('comment', commentId);
}

View File

@ -1,7 +1,9 @@
import { reportDialog } from 'utilities/reportDialog';
export function answerboxReportHandler(event: Event): void {
event.preventDefault();
const button = event.target as HTMLButtonElement;
const answerId = button.dataset.aId;
window['reportDialog']('answer', answerId);
reportDialog('answer', answerId);
}

View File

@ -1,4 +1,6 @@
import { reportDialog } from 'utilities/reportDialog';
export function reportEventHandler(event: Event): void {
const element = event.target as HTMLElement;
window['reportDialog']('question', element.dataset.qId);
reportDialog('question', element.dataset.qId);
}

View File

@ -1,7 +1,9 @@
import { reportDialog } from 'utilities/reportDialog';
export function questionboxReportHandler(event: Event): void {
event.preventDefault();
const button = event.target as HTMLButtonElement;
const questionId = button.dataset.qId;
window['reportDialog']('question', questionId);
reportDialog('question', questionId);
}

View File

@ -1,6 +1,8 @@
import { reportDialog } from 'utilities/reportDialog';
export function userReportHandler(event: Event): void {
event.preventDefault();
const button: HTMLButtonElement = event.target as HTMLButtonElement;
window['reportDialog']('user', button.dataset.target);
reportDialog('user', button.dataset.target);
}