switch crypto implementation and add spinner

This commit is contained in:
2023-05-08 22:13:08 -07:00
parent e866a4a643
commit ddd1005067
11 changed files with 387 additions and 43 deletions

View File

@ -7,6 +7,7 @@
import { navigate } from '../lib/routing.js';
import Link from '../ui/Link.svelte';
import ErrorAlert from '../ui/ErrorAlert.svelte';
import Spinner from '../ui/Spinner.svelte';
let errorMsg = null;
@ -19,6 +20,7 @@
}
}
let saving = false;
async function save() {
if (passphrase !== confirmPassphrase) {
alert.shake();
@ -27,6 +29,7 @@
let credentials = {AccessKeyId, SecretAccessKey};
try {
saving = true;
await invoke('save_credentials', {credentials, passphrase});
if ($appState.currentRequest) {
navigate('Approve');
@ -47,6 +50,8 @@
if (alert) {
alert.shake();
}
saving = false;
}
}
</script>
@ -65,7 +70,13 @@
<input type="password" placeholder="Passphrase" bind:value="{passphrase}" class="input input-bordered" />
<input type="password" placeholder="Re-enter passphrase" bind:value={confirmPassphrase} class="input input-bordered" on:change={confirm} />
<input type="submit" class="btn btn-primary" />
<button type="submit" class="btn btn-primary">
{#if saving}
<Spinner class="w-5 h-5" color="primary-content" thickness="2px"/>
{:else}
Submit
{/if}
</button>
<Link target="Home" hotkey="Escape">
<button class="btn btn-sm btn-outline w-full">Cancel</button>
</Link>