Add tsx syntax to UserPassUserDelete.
This commit is contained in:
parent
351ad5bbfe
commit
1c9713a7fd
|
@ -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");
|
||||
}
|
||||
}
|
34
src/pages/Access/Auth/userpass/UserPassUserDelete.tsx
Normal file
34
src/pages/Access/Auth/userpass/UserPassUserDelete.tsx
Normal 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");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue