update methods

This commit is contained in:
fmtabbara
2022-05-17 15:43:37 +01:00
parent 20828d0d28
commit 8a37df64b5
2 changed files with 8 additions and 9 deletions
+6 -7
View File
@@ -36,14 +36,13 @@ export const MockAccountsProvider: React.FC = ({ children }) => {
const handleAccountToEdit = (accountName: string) =>
setAccountToEdit(accounts?.find((acc) => acc.id === accountName));
const handleSelectAccount = async (accountName: string) => {
if (accountName !== selectedAccount?.id) {
const match = accounts?.find((acc) => acc.id === accountName);
setSelectedAccount(match);
}
const handleSelectAccount = async ({ accountName }: { accountName: string; password: string }) => {
const match = accounts?.find((acc) => acc.id === accountName);
setSelectedAccount(match);
return true;
};
const handleGetAcccountMnemonic = async ({ accountName }: { password: string; accountName: string }) => {
const handleGetAccountMnemonic = async ({ accountName }: { password: string; accountName: string }) => {
try {
setIsLoading(true);
const mnemonic = 'test mnemonic';
@@ -73,7 +72,7 @@ export const MockAccountsProvider: React.FC = ({ children }) => {
handleAccountToEdit,
handleSelectAccount,
handleImportAccount,
handleGetAcccountMnemonic,
handleGetAccountMnemonic,
}),
[accounts, selectedAccount, accountToEdit, dialogToDisplay, isLoading, error, accountMnemonic],
)}
+2 -2
View File
@@ -62,6 +62,6 @@ export const showMnemonicForAccount = async ({ password, accountName }: { passwo
return res;
};
export const switchAccount = async (accountId: string) => {
await invoke('sign_in_decrypted_account', { accountId });
export const switchAccount = async ({ accountId, password }: { accountId: string; password: string }) => {
await invoke('sign_in_with_password_and_account_id', { accountId, password });
};