From 7082a12eae860737b07bc4aeb62fe287a0cc9b18 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Mon, 14 Mar 2022 22:50:32 +0000 Subject: [PATCH] update global error and load state from children --- nym-wallet/src/context/main.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nym-wallet/src/context/main.tsx b/nym-wallet/src/context/main.tsx index 75e6818025..75e32e4657 100644 --- a/nym-wallet/src/context/main.tsx +++ b/nym-wallet/src/context/main.tsx @@ -30,11 +30,14 @@ type TClientContext = { currency?: TCurrency; isLoading: boolean; error?: string; + setIsLoading: (isLoading: boolean) => void; + setError: (value?: string) => void; switchNetwork: (network: Network) => void; getBondDetails: () => Promise; handleShowSettings: () => void; handleShowAdmin: () => void; logIn: (mnemonic: string) => void; + signInWithPassword: (password: string) => void; logOut: () => void; }; @@ -90,7 +93,6 @@ export const ClientContextProvider = ({ children }: { children: React.ReactNode try { setIsLoading(true); await signInWithMnemonic(mnemonic || ''); - await getBondDetails(); setNetwork('MAINNET'); history.push('/balance'); } catch (e) { @@ -99,6 +101,8 @@ export const ClientContextProvider = ({ children }: { children: React.ReactNode } }; + const signInWithPassword = (password: string) => password; + const logOut = async () => { setClientDetails(undefined); setNetwork(undefined); @@ -124,6 +128,9 @@ export const ClientContextProvider = ({ children }: { children: React.ReactNode showSettings, network, currency, + setIsLoading, + setError, + signInWithPassword, switchNetwork, getBondDetails, handleShowSettings,