1
0
Fork 0
VaultUI/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx
2022-01-06 22:57:12 +00:00

44 lines
1.2 KiB
TypeScript

import { Page } from "../../../../types/Page";
import { SecretTitleElement } from "../SecretTitleElement";
import { deleteSecret } from "../../../../api/kv/deleteSecret";
import { Component, render } from "preact";
import i18next from "i18next";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
export class KeyValueDelete extends Component<DefaultPageProps> {
render() {
const baseMount = this.props.matches["baseMount"];
const secretPath = this.props.matches["secretPath"].split("/");
const item = this.props.matches["item"];
return (
<>
<SecretTitleElement
type="kv"
baseMount={baseMount}
secretPath={secretPath}
item={item}
suffix={i18next.t("kv_sec_edit_suffix")}
/>
<div>
<h5>{i18next.t("kv_delete_text")}</h5>
<button
class="uk-button uk-button-danger"
onClick={async () => {
await deleteSecret(
baseMount,
secretPath,
item,
);
window.history.back();
}}
>
{i18next.t("kv_delete_btn")}
</button>
</div>
</>
);
}
}