this.button.addEventListener("click", (event) => {
event.preventDefault();
+ if (!(typeof this.button.dataset.confirmMessage === "string")) {
+ throw new Error("The button does not provides a confirmMessage.");
+ }
+
const deleteHandler = new Delete(
[this.userId],
() => {
* @since 5.5
*/
-import * as Language from "../../../../../Language";
import * as UiConfirmation from "../../../../../Ui/Confirmation";
import * as Ajax from "../../../../../Ajax";
import { CallbackSuccess } from "../../../../../Ajax/Data";
private successCallback: CallbackSuccess;
private deleteMessage: string;
- public constructor(userIDs: number[], successCallback: CallbackSuccess, deleteMessage?: string) {
+ public constructor(userIDs: number[], successCallback: CallbackSuccess, deleteMessage: string) {
this.userIDs = userIDs;
this.successCallback = successCallback;
- if (deleteMessage) {
- this.deleteMessage = deleteMessage;
- } else {
- this.deleteMessage = Language.get("wcf.button.delete.confirmMessage"); // @todo find better variable for a generic message
- }
+ this.deleteMessage = deleteMessage;
}
public delete(): void {
init() {
this.button.addEventListener("click", (event) => {
event.preventDefault();
+ if (!(typeof this.button.dataset.confirmMessage === "string")) {
+ throw new Error("The button does not provides a confirmMessage.");
+ }
const deleteHandler = new Delete_1.default([this.userId], () => {
this.userDataElement.remove();
}, this.button.dataset.confirmMessage);
* @module WoltLabSuite/Core/Acp/Ui/User/Action/Handler
* @since 5.5
*/
-define(["require", "exports", "tslib", "../../../../../Language", "../../../../../Ui/Confirmation", "../../../../../Ajax"], function (require, exports, tslib_1, Language, UiConfirmation, Ajax) {
+define(["require", "exports", "tslib", "../../../../../Ui/Confirmation", "../../../../../Ajax"], function (require, exports, tslib_1, UiConfirmation, Ajax) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Delete = void 0;
- Language = tslib_1.__importStar(Language);
UiConfirmation = tslib_1.__importStar(UiConfirmation);
Ajax = tslib_1.__importStar(Ajax);
class Delete {
constructor(userIDs, successCallback, deleteMessage) {
this.userIDs = userIDs;
this.successCallback = successCallback;
- if (deleteMessage) {
- this.deleteMessage = deleteMessage;
- }
- else {
- this.deleteMessage = Language.get("wcf.button.delete.confirmMessage"); // @todo find better variable for a generic message
- }
+ this.deleteMessage = deleteMessage;
}
delete() {
UiConfirmation.show({