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 { SecretTitleElement } from "../SecretTitleElement";
import { deleteSecret } from "../../../api/kv/deleteSecret";
import { makeElement } from "z-makeelement";
import { render } from "preact";
import i18next from "i18next";
export class KeyValueDeletePage extends Page {
@ -18,31 +18,26 @@ export class KeyValueDeletePage extends Page {
}
}
async render(): Promise<void> {
await this.router.setPageContent(
makeElement({
tag: "div",
children: [
makeElement({
tag: "h5",
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(
this.state.baseMount,
this.state.secretMountType,
this.state.secretPath,
this.state.secretItem,
this.state.secretVersion,
);
await this.goBack();
},
}),
],
}),
render(
<div>
<h5>{i18next.t("kv_delete_text")}</h5>
<button
class="uk-button uk-button-danger"
onClick={async () => {
await deleteSecret(
this.state.baseMount,
this.state.secretMountType,
this.state.secretPath,
this.state.secretItem,
this.state.secretVersion,
);
await this.goBack();
}}
>
{i18next.t("kv_delete_btn")}
</button>
</div>,
this.router.pageContentElement,
);
}