feat: simplify account management

This commit is contained in:
2024-03-06 11:11:24 +07:00
parent 8eaf47f6d2
commit 95294a80cb
7 changed files with 49 additions and 558 deletions

View File

@@ -25,7 +25,7 @@ export class Ark {
const cmd: string[] = await invoke("get_all_nsecs");
for (const item of cmd) {
accounts.push({ npub: item.replace(".nsec", "") });
accounts.push({ npub: item.replace(".npub", "") });
}
this.accounts = accounts;
@@ -37,9 +37,8 @@ export class Ark {
public async load_selected_account(npub: string) {
try {
const fullNpub = `${npub}.nsec`;
const cmd: boolean = await invoke("load_selected_account", {
npub: fullNpub,
npub,
});
return cmd;
@@ -75,10 +74,6 @@ export class Ark {
password,
});
if (cmd) {
await invoke("update_signer", { nsec });
}
return cmd;
} catch (e) {
throw new Error(String(e));

View File

@@ -3,8 +3,8 @@ export function CancelIcon(props: JSX.IntrinsicElements["svg"]) {
<svg width="24" height="24" fill="none" viewBox="0 0 24 24" {...props}>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-width="2"
strokeLinecap="round"
strokeWidth="2"
d="m5 5 14 14m0-14L5 19"
/>
</svg>