Skip to content

Commit

Permalink
Remove local storage init
Browse files Browse the repository at this point in the history
  • Loading branch information
schnetzlerjoe committed Sep 12, 2023
1 parent a1e02c3 commit 18da49c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/ui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { isMetaMaskInstalled, initSnap, isSnapInstalled, installSnap } from '../utils/snap';
import { state } from '../store/state';
import { goto } from '$app/navigation';
import { LOCAL_STORAGE_CHAINS, LOCAL_STORAGE_INIT } from '../utils/general';
import { LOCAL_STORAGE_CHAINS } from '../utils/general';
import { chains } from '../store/chains';
let isMetaMaskInstalledValue = false;
Expand All @@ -22,7 +22,6 @@
loading = true;
isMetaMaskInstalledValue = isMetaMaskInstalled() ?? false;
isSnapInstalledValue = await isSnapInstalled() ?? false;
isSnapInitValue = (localStorage.getItem(LOCAL_STORAGE_INIT) === "true");
loading = false;
};
Expand All @@ -40,14 +39,12 @@
const chainsFromInit = await initSnap();
localStorage.setItem(LOCAL_STORAGE_CHAINS, JSON.stringify(chainsFromInit));
chains.set(chainsFromInit);
localStorage.setItem(LOCAL_STORAGE_INIT, "true");
isSnapInitValue = true;
$state.connected = true;
loading = false;
} catch (err: any) {
loading = false;
if (err.message == "The Cosmos Snap has already been initialized.") {
localStorage.setItem(LOCAL_STORAGE_INIT, "true");
isSnapInitValue = true;
$state.connected = true;
goto("/balances")
Expand Down

0 comments on commit 18da49c

Please sign in to comment.