pl-fe: fetch instance before calling verifyCredentials
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -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<VerifyCredentialsRequestAction>({ 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<VerifyCredentialsSuccessAction>({ type: VERIFY_CREDENTIALS_SUCCESS, token, account });
|
||||
|
||||
Reference in New Issue
Block a user