move app state to store

This commit is contained in:
2023-04-25 08:49:00 -07:00
parent 865b7fd5c4
commit 6f9cd6b471
11 changed files with 63 additions and 65 deletions

View File

@ -2,11 +2,10 @@
import { invoke } from '@tauri-apps/api/tauri';
import { navigate } from '../lib/routing.js';
import { appState } from '../lib/state.js';
import Link from '../ui/Link.svelte';
import Icon from '../ui/Icon.svelte';
export let appState;
async function approve() {
let status = await invoke('get_session_status');
@ -22,8 +21,8 @@
}
var appName = null;
if (appState.currentRequest.clients.length === 1) {
let path = appState.currentRequest.clients[0].exe;
if ($appState.currentRequest.clients.length === 1) {
let path = $appState.currentRequest.clients[0].exe;
let m = path.match(/\/([^/]+?$)|\\([^\\]+?$)/);
appName = m[1] || m[2];
}
@ -34,7 +33,7 @@
<!-- <div class="p-4 rounded-box border-2 border-neutral-content"> -->
<div class="space-y-1 mb-4">
<h2 class="text-xl font-bold">{appName ? `"${appName}"` : 'An appplication'} would like to access your AWS credentials.</h2>
{#each appState.currentRequest.clients as client}
{#each $appState.currentRequest.clients as client}
<p>Path: {client ? client.exe : 'Unknown'}</p>
<p>PID: {client ? client.pid : 'Unknown'}</p>
{/each}