<script>
import { listen } from '@tauri-apps/api/event';
import { invoke } from '@tauri-apps/api/tauri';

import { appState } from './lib/state.js';
import { views, currentView, navigate } from './lib/routing.js';


$views = import.meta.glob('./views/*.svelte', {eager: true});
navigate('Home');

invoke('get_config').then(config => $appState.config = config);

listen('credentials-request', (tauriEvent) => {
    $appState.pendingRequests.put(tauriEvent.payload);
});
</script>


<svelte:component this="{$currentView}" />
