remove account when no password

This commit is contained in:
Sebastian 2023-05-26 17:09:47 -03:00
parent 69b66e715e
commit 8d85426f0e
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
3 changed files with 15 additions and 2 deletions

View File

@ -21,6 +21,9 @@ export function HandleAccountNotReady({
if (officer.state === "locked") {
return (
<UnlockAccount
onRemoveAccount={() => {
officer.forget();
}}
onAccountUnlocked={(pwd) => {
officer.tryUnlock(pwd);
}}

View File

@ -6,8 +6,10 @@ import { createNewForm } from "../handlers/forms.js";
export function UnlockAccount({
onAccountUnlocked,
onRemoveAccount,
}: {
onAccountUnlocked: (password: string) => void;
onRemoveAccount: () => void;
}): VNode {
const Form = createNewForm<{
password: string;
@ -64,6 +66,15 @@ export function UnlockAccount({
</div>
</Form.Provider>
</div>
<button
type="button"
onClick={() => {
onRemoveAccount();
}}
class="m-4 block rounded-md bg-red-600 px-3 py-2 text-center text-sm text-white shadow-sm hover:bg-red-500 "
>
Remove account
</button>
</div>
</div>
);

View File

@ -43,8 +43,7 @@ export function buildStorageKey<Key = string>(
return {
id: name,
codec: codec ?? (codecForString() as Codec<Key>),
[opaque_StorageKey]: true,
};
} as StorageKey<Key>;
}
export interface StorageState<Type = string> {