Skip to content

Commit

Permalink
Merge branch '#232' into fix/qoh-card
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Dec 19, 2023
2 parents dcdbcf0 + 0078fb6 commit 9dbe993
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const getUserProfile = async (token: any): Promise<any> => {
'Content-Type': 'application/json'
}
});
if(hasError(resp)) return Promise.reject("Error getting user profile: " + JSON.stringify(resp.data));
if(resp.data.facilities.length === 0 ) return Promise.reject("User is not associated with any facility: " + JSON.stringify(resp.data));
if(hasError(resp)) return Promise.reject("Error getting user profile");
return Promise.resolve(resp.data)
} catch(error: any) {
return Promise.reject(error)
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ const actions: ActionTree<UserState, RootState> = {
// TODO Check if handling of specific status codes is required.
showToast(translate('Something went wrong while login. Please contact administrator'));
console.error("error", err);
return Promise.reject(new Error(err))
// Added ternary check for serverResponse as in to correctly display the message on UI, need to remove this once all the service reject in same format
return Promise.reject(new Error(err?.serverResponse ? err.serverResponse : err))
}
},

Expand Down

0 comments on commit 9dbe993

Please sign in to comment.