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,31 +18,26 @@ 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"), await deleteSecret(
}), this.state.baseMount,
makeElement({ this.state.secretMountType,
tag: "button", this.state.secretPath,
class: ["uk-button", "uk-button-danger"], this.state.secretItem,
text: i18next.t("kv_delete_btn"), this.state.secretVersion,
onclick: async () => { );
await deleteSecret( await this.goBack();
this.state.baseMount, }}
this.state.secretMountType, >
this.state.secretPath, {i18next.t("kv_delete_btn")}
this.state.secretItem, </button>
this.state.secretVersion, </div>,
); this.router.pageContentElement,
await this.goBack();
},
}),
],
}),
); );
} }