diff --git a/packages/pl-fe/src/actions/auth.ts b/packages/pl-fe/src/actions/auth.ts index d2a303795..18ad7c8aa 100644 --- a/packages/pl-fe/src/actions/auth.ts +++ b/packages/pl-fe/src/actions/auth.ts @@ -176,13 +176,15 @@ interface VerifyCredentialsFailAction { } const verifyCredentials = (token: string, accountUrl?: string) => - (dispatch: AppDispatch, getState: () => RootState) => { + async (dispatch: AppDispatch, getState: () => RootState) => { const baseURL = parseBaseURL(accountUrl) || BuildConfig.BACKEND_URL; dispatch({ type: VERIFY_CREDENTIALS_REQUEST, token }); const client = new PlApiClient(baseURL, token); + await client.instance.getInstance(); + return client.settings.verifyCredentials().then((account) => { dispatch(importEntities({ accounts: [account] })); dispatch({ type: VERIFY_CREDENTIALS_SUCCESS, token, account });