2022-11-23 17:11:44 -08:00
|
|
|
<script>
|
2022-11-27 22:03:15 -08:00
|
|
|
import { onMount, createEventDispatcher } from 'svelte';
|
2022-12-22 21:50:09 -08:00
|
|
|
import { invoke } from '@tauri-apps/api/tauri';
|
|
|
|
import Button from '../ui/Button.svelte';
|
2022-11-23 17:11:44 -08:00
|
|
|
|
2022-11-27 22:03:15 -08:00
|
|
|
export let appState;
|
2022-11-23 17:11:44 -08:00
|
|
|
|
2022-11-27 22:03:15 -08:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
onMount(async () => {
|
|
|
|
// will block until a request comes in
|
|
|
|
let req = await appState.pendingRequests.get();
|
|
|
|
appState.currentRequest = req;
|
2022-12-13 16:50:44 -08:00
|
|
|
console.log('Got credentials request from queue:');
|
|
|
|
console.log(req);
|
2022-11-27 22:03:15 -08:00
|
|
|
dispatch('navigate', {target: 'Approve'});
|
|
|
|
});
|
2022-12-22 21:50:09 -08:00
|
|
|
|
|
|
|
let status = 'unknown';
|
|
|
|
onMount(async() => {
|
|
|
|
status = await invoke('get_session_status');
|
|
|
|
})
|
2022-11-23 17:11:44 -08:00
|
|
|
</script>
|
|
|
|
|
2022-12-22 21:50:09 -08:00
|
|
|
<h1 class="text-4xl text-gray-300">Creddy</h1>
|
|
|
|
|
|
|
|
<p>Credential status: {status}</p>
|
|
|
|
|
|
|
|
{#if status === 'locked'}
|
|
|
|
<Button on:click={() => dispatch('navigate', {target: 'Unlock'})}>Unlock</Button>
|
|
|
|
{:else if status === 'empty'}
|
|
|
|
<Button on:click={() => dispatch('navigate', {target: 'EnterCredentials'})}>
|
|
|
|
Enter Credentials
|
|
|
|
</Button>
|
|
|
|
{/if}
|