1
0
Fork 0

Add tsx syntax to KeyValueDelete.

This commit is contained in:
Kitteh 2021-05-22 10:06:07 +01:00
parent bc78661c49
commit 2944a68af2

View file

@ -1,7 +1,7 @@
import { Page } from "../../../types/Page"; import { Page } from "../../../types/Page";
import { SecretTitleElement } from "../SecretTitleElement"; import { SecretTitleElement } from "../SecretTitleElement";
import { deleteSecret } from "../../../api/kv/deleteSecret"; import { deleteSecret } from "../../../api/kv/deleteSecret";
import { makeElement } from "z-makeelement"; import { render } from "preact";
import i18next from "i18next"; import i18next from "i18next";
export class KeyValueDeletePage extends Page { export class KeyValueDeletePage extends Page {
@ -18,19 +18,12 @@ export class KeyValueDeletePage extends Page {
} }
} }
async render(): Promise<void> { async render(): Promise<void> {
await this.router.setPageContent( render(
makeElement({ <div>
tag: "div", <h5>{i18next.t("kv_delete_text")}</h5>
children: [ <button
makeElement({ class="uk-button uk-button-danger"
tag: "h5", onClick={async () => {
text: i18next.t("kv_delete_text"),
}),
makeElement({
tag: "button",
class: ["uk-button", "uk-button-danger"],
text: i18next.t("kv_delete_btn"),
onclick: async () => {
await deleteSecret( await deleteSecret(
this.state.baseMount, this.state.baseMount,
this.state.secretMountType, this.state.secretMountType,
@ -39,10 +32,12 @@ export class KeyValueDeletePage extends Page {
this.state.secretVersion, this.state.secretVersion,
); );
await this.goBack(); await this.goBack();
}, }}
}), >
], {i18next.t("kv_delete_btn")}
}), </button>
</div>,
this.router.pageContentElement,
); );
} }