From 1c9713a7fd1fe1e478b54aa29c768ee2c619f45f Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sun, 23 May 2021 12:34:20 +0100 Subject: [PATCH] Add tsx syntax to UserPassUserDelete. --- .../Auth/userpass/UserPassUserDelete.ts | 39 ------------------- .../Auth/userpass/UserPassUserDelete.tsx | 34 ++++++++++++++++ 2 files changed, 34 insertions(+), 39 deletions(-) delete mode 100644 src/pages/Access/Auth/userpass/UserPassUserDelete.ts create mode 100644 src/pages/Access/Auth/userpass/UserPassUserDelete.tsx diff --git a/src/pages/Access/Auth/userpass/UserPassUserDelete.ts b/src/pages/Access/Auth/userpass/UserPassUserDelete.ts deleted file mode 100644 index 04872fd..0000000 --- a/src/pages/Access/Auth/userpass/UserPassUserDelete.ts +++ /dev/null @@ -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 { - await this.router.changePage("USERPASS_USERS_LIST"); - } - async render(): Promise { - 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"); - } -} diff --git a/src/pages/Access/Auth/userpass/UserPassUserDelete.tsx b/src/pages/Access/Auth/userpass/UserPassUserDelete.tsx new file mode 100644 index 0000000..26adc6c --- /dev/null +++ b/src/pages/Access/Auth/userpass/UserPassUserDelete.tsx @@ -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 { + await this.router.changePage("USERPASS_USERS_LIST"); + } + async render(): Promise { + render( + <> +
{i18next.t("userpass_user_delete_text")}
+ + , + this.router.pageContentElement, + ); + } + + get name(): string { + return i18next.t("userpass_user_delete_title"); + } +}