mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-30 00:31:03 +08:00
Refresh balance on page load
This commit is contained in:
+7
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="typescript">
|
||||
import { Router, Route } from "svelte-routing";
|
||||
import { getConfig } from '@app/config';
|
||||
import { session } from '@app/session';
|
||||
import { state, session } from '@app/session';
|
||||
|
||||
import Home from '@app/base/home/Index.svelte';
|
||||
import Vesting from '@app/base/vesting/Index.svelte';
|
||||
@@ -13,6 +13,11 @@
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Modal from '@app/Modal.svelte';
|
||||
|
||||
const loadConfig = getConfig().then(cfg => {
|
||||
state.refreshBalance(cfg);
|
||||
return cfg;
|
||||
});
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter') {
|
||||
let elems = document.querySelectorAll<HTMLElement>('button.primary');
|
||||
@@ -39,7 +44,7 @@
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
<div class="app">
|
||||
{#await getConfig()}
|
||||
{#await loadConfig}
|
||||
<!-- Loading wallet -->
|
||||
<div class="wrapper">
|
||||
<Loading center />
|
||||
|
||||
+1
-1
@@ -41,8 +41,8 @@ export interface Store extends Readable<State> {
|
||||
|
||||
export const loadState = (initial: State): Store => {
|
||||
const store = writable<State>(initial);
|
||||
|
||||
const session = window.localStorage.getItem("session");
|
||||
|
||||
if (session) store.set({ connection: Connection.Connected, session: JSON.parse(session) });
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user