diff options
author | Sebastian <sebasjm@gmail.com> | 2023-05-26 17:09:47 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-05-26 17:09:47 -0300 |
commit | 8d85426f0e0ceec5297f43f5688d0d9bc4aa4a71 (patch) | |
tree | ac042287e736b1921a47cb93281dc0dc8ea45ff8 /packages | |
parent | 69b66e715eae039330898f470a8993d1d154b583 (diff) |
remove account when no password
Diffstat (limited to 'packages')
3 files changed, 15 insertions, 2 deletions
diff --git a/packages/exchange-backoffice-ui/src/pages/HandleAccountNotReady.tsx b/packages/exchange-backoffice-ui/src/pages/HandleAccountNotReady.tsx index b0c430875..05fd0a019 100644 --- a/packages/exchange-backoffice-ui/src/pages/HandleAccountNotReady.tsx +++ b/packages/exchange-backoffice-ui/src/pages/HandleAccountNotReady.tsx @@ -21,6 +21,9 @@ export function HandleAccountNotReady({ if (officer.state === "locked") { return ( <UnlockAccount + onRemoveAccount={() => { + officer.forget(); + }} onAccountUnlocked={(pwd) => { officer.tryUnlock(pwd); }} diff --git a/packages/exchange-backoffice-ui/src/pages/UnlockAccount.tsx b/packages/exchange-backoffice-ui/src/pages/UnlockAccount.tsx index 941e28627..74cb0d056 100644 --- a/packages/exchange-backoffice-ui/src/pages/UnlockAccount.tsx +++ b/packages/exchange-backoffice-ui/src/pages/UnlockAccount.tsx @@ -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> ); diff --git a/packages/web-util/src/hooks/useLocalStorage.ts b/packages/web-util/src/hooks/useLocalStorage.ts index 45b7abd3c..f6241f427 100644 --- a/packages/web-util/src/hooks/useLocalStorage.ts +++ b/packages/web-util/src/hooks/useLocalStorage.ts @@ -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> { |