1
0
Fork 0

Add tsx syntax to UserPassUserDelete.

This commit is contained in:
Kitteh 2021-05-23 12:34:20 +01:00
parent 351ad5bbfe
commit 1c9713a7fd
2 changed files with 34 additions and 39 deletions

View file

@ -1,39 +0,0 @@
import { Page } from "../../../../types/Page";
import { deleteUserPassUser } from "../../../../api/auth/userpass/deleteUserPassUser";
import { makeElement } from "z-makeelement";
import i18next from "i18next";
export class UserPassUserDeletePage extends Page {
constructor() {
super();
}
async goBack(): Promise<void> {
await this.router.changePage("USERPASS_USERS_LIST");
}
async render(): Promise<void> {
await this.router.setPageContent(
makeElement({
tag: "div",
children: [
makeElement({
tag: "h5",
text: i18next.t("userpass_user_delete_text"),
}),
makeElement({
tag: "button",
class: ["uk-button", "uk-button-danger"],
text: i18next.t("userpass_user_delete_btn"),
onclick: async () => {
await deleteUserPassUser(this.state.authPath, this.state.userPassUser);
await this.goBack();
},
}),
],
}),
);
}
get name(): string {
return i18next.t("userpass_user_delete_title");
}
}

View file

@ -0,0 +1,34 @@
import { Page } from "../../../../types/Page";
import { deleteUserPassUser } from "../../../../api/auth/userpass/deleteUserPassUser";
import { render } from "preact";
import i18next from "i18next";
export class UserPassUserDeletePage extends Page {
constructor() {
super();
}
async goBack(): Promise<void> {
await this.router.changePage("USERPASS_USERS_LIST");
}
async render(): Promise<void> {
render(
<>
<h5>{i18next.t("userpass_user_delete_text")}</h5>
<button
class="uk-button uk-button-danger"
onClick={async () => {
await deleteUserPassUser(this.state.authPath, this.state.userPassUser);
await this.goBack();
}}
>
{i18next.t("userpass_user_delete_btn")}
</button>
</>,
this.router.pageContentElement,
);
}
get name(): string {
return i18next.t("userpass_user_delete_title");
}
}