move re-hide to main request handler
This commit is contained in:
@ -5,20 +5,27 @@
|
||||
export let appState;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
let error = null;
|
||||
let AccessKeyId, SecretAccessKey, passphrase
|
||||
|
||||
async function save() {
|
||||
try {
|
||||
console.log('Saving credentials.');
|
||||
let credentials = {AccessKeyId, SecretAccessKey};
|
||||
console.log(credentials);
|
||||
await invoke('save_credentials', {credentials, passphrase});
|
||||
if (appState.currentRequest) {
|
||||
dispatch('navigate', {target: 'ShowApproved'})
|
||||
|
||||
try {
|
||||
await invoke('save_credentials', {credentials, passphrase});
|
||||
if (appState.currentRequest) {
|
||||
dispatch('navigate', {target: 'ShowApproved'})
|
||||
}
|
||||
else {
|
||||
dispatch('navigate', {target: 'Home'})
|
||||
}
|
||||
}
|
||||
else {
|
||||
dispatch('navigate', {target: 'Home'})
|
||||
catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error saving credentials:", e);
|
||||
@ -26,16 +33,19 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
<div class="text-red-400">{error}</div>
|
||||
{/if}
|
||||
|
||||
<form action="#" on:submit|preventDefault="{save}">
|
||||
<div class="text-gray-200">AWS Access Key ID</div>
|
||||
<input class="text-gray-200 bg-zinc-800" type="text" bind:value="{AccessKeyId}" />
|
||||
|
||||
<div class="text-gray-200">AWS Secret Access Key</div>
|
||||
<input class="text-gray-200 bg-zinc-800" type="text" bind:value="{SecretAccessKey}" />
|
||||
<input class="text-gray-200 bg-zinc-800" type="password" bind:value="{SecretAccessKey}" />
|
||||
|
||||
<div class="text-gray-200">Passphrase</div>
|
||||
<input class="text-gray-200 bg-zinc-800" type="text" bind:value="{passphrase}" />
|
||||
<input class="text-gray-200 bg-zinc-800" type="password" bind:value="{passphrase}" />
|
||||
|
||||
<input class="text-gray-200" type="submit" />
|
||||
</form>
|
||||
|
@ -28,7 +28,7 @@
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
<div class="text-red-400">Error attempting to send approval: {error}</div>
|
||||
<div class="text-red-400">{error}</div>
|
||||
{:else}
|
||||
<h1 class="text-4xl text-gray-300">Approved!</h1>
|
||||
{/if}
|
||||
|
@ -30,6 +30,7 @@
|
||||
{#if error}
|
||||
<div class="text-red-400">{error}</div>
|
||||
{/if}
|
||||
|
||||
<form action="#" on:submit|preventDefault="{unlock}">
|
||||
<div class="text-gray-200">Enter your passphrase:</div>
|
||||
<input autofocus class="text-gray-200 bg-zinc-800" type="password" placeholder="correct horse battery staple" bind:value="{passphrase}" />
|
||||
|
Reference in New Issue
Block a user