update global error and load state from children

This commit is contained in:
fmtabbara
2022-03-14 22:50:32 +00:00
parent e5898c9053
commit 7082a12eae
+8 -1
View File
@@ -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<void>;
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,