Fixes ACCOUNTS-5C5. Resolve fetchAvailableApps with empty array in case when user's id is unavailable by unknown reasons.

This commit is contained in:
ErickSkrauch 2019-05-20 16:43:55 +03:00
parent afd6c3c300
commit 8f6ff72965
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E

View File

@ -40,9 +40,9 @@ function addApp(app: OauthAppResponse): AddAppAction {
export function fetchAvailableApps() {
return async (dispatch: Dispatch<any>, getState: () => {user: User}): Promise<void> => {
const { id } = getState().user;
if (!id) {
throw new Error('store.user.id is required for this action');
dispatch(setAppsList([]));
return;
}
const apps = await oauth.getAppsByUser(id);