Skip to content

Commit

Permalink
fix: unwrap dispatch error (#2379)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbodnar committed Jan 27, 2022
1 parent 47b333d commit 69b1e68
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/src/components/accounts/SetupImplicit.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class SetupImplicit extends Component {
this.setState({ creatingAccount: true });
await Mixpanel.withTracking("CA Create account from implicit",
async () => {
await dispatch(createAccountFromImplicit({ accountId: newAccountId, implicitAccountId, recoveryMethod }));
await dispatch(createAccountFromImplicit({ accountId: newAccountId, implicitAccountId, recoveryMethod })).unwrap();
},
() => {
this.setState({ creatingAccount: false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function InitialDepositWrapper({ history }) {
await Mixpanel.withTracking("CA Create account from implicit",
async () => {
setClaimingAccount(true);
await dispatch(createAccountFromImplicit({ accountId, implicitAccountId, recoveryMethod }));
await dispatch(createAccountFromImplicit({ accountId, implicitAccountId, recoveryMethod })).unwrap();
},
async (e) => {
console.warn(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const SetupLedger = (props) => {
return;
}

await dispatch(createNewAccount({ accountId, fundingOptions, recoveryMethod: 'ledger', publicKey, recaptchaToken }));
await dispatch(createNewAccount({ accountId, fundingOptions, recoveryMethod: 'ledger', publicKey, recaptchaToken })).unwrap();
if (fundingOptions?.fundingAmount) {
setLinkdropAmount(fundingOptions.fundingAmount);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/redux/actions/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const handleCreateAccountWithSeedPhrase = (accountId, recoveryKeyPair, fu
}

try {
await dispatch(createAccountWithSeedPhrase({ accountId, recoveryKeyPair, fundingOptions, recaptchaToken }));
await dispatch(createAccountWithSeedPhrase({ accountId, recoveryKeyPair, fundingOptions, recaptchaToken })).unwrap();
} catch (error) {
if (await wallet.accountExists(accountId)) {
// Requests sometimes fail after creating the NEAR account for another reason (transport error?)
Expand Down Expand Up @@ -546,7 +546,7 @@ export const refreshAccount = (basicData = false) => async (dispatch, getState)
}

dispatch(setLocalStorage(wallet.accountId));
await dispatch(refreshAccountOwner(selectFlowLimitationAccountData(getState())));
await dispatch(refreshAccountOwner(selectFlowLimitationAccountData(getState()))).unwrap();

if (!basicData && !selectFlowLimitationAccountBalance(getState())) {
dispatch(getBalance('', selectFlowLimitationAccountData(getState())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const createAccountFromImplicit = createAsyncThunk(
}
const publicKey = new PublicKey({ keyType: KeyType.ED25519, data: Buffer.from(implicitAccountId, 'hex') });
const fundingOptions = { fundingAccountId: implicitAccountId };
await dispatch(createNewAccount({ accountId, fundingOptions, recoveryMethod, publicKey }));
await dispatch(createNewAccount({ accountId, fundingOptions, recoveryMethod, publicKey })).unwrap();
}
// TODO: showAlert({ onlyError: true })
);
Expand All @@ -148,7 +148,7 @@ export const createAccountWithSeedPhrase = createAsyncThunk(
const recoveryMethod = 'phrase';
const previousAccountId = wallet.accountId;
await wallet.saveAccount(accountId, recoveryKeyPair);
await dispatch(createNewAccount({ accountId, fundingOptions, recoveryMethod, publicKey: recoveryKeyPair.publicKey, previousAccountId, recaptchaToken }));
await dispatch(createNewAccount({ accountId, fundingOptions, recoveryMethod, publicKey: recoveryKeyPair.publicKey, previousAccountId, recaptchaToken })).unwrap();
}
// TODO: showAlert()
);
Expand Down

0 comments on commit 69b1e68

Please sign in to comment.