Skip to content

Commit

Permalink
Fix issue with API returning 204
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarkowsky committed Feb 16, 2024
1 parent 0949974 commit 90bb234
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion express-api/src/controllers/users/usersController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const getSelf = async (req: Request, res: Response) => {
try {
const user = userServices.normalizeKeycloakUser(req.user as KeycloakUser);
const result = await userServices.getUser(user.username);
if (result) {
if (result && result !== null) {
return res.status(200).send(result);
} else {
return res.status(204).send(); //Valid request, but no user for this keycloak login.
Expand Down
4 changes: 2 additions & 2 deletions react-app/src/pages/AccessRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const AccessRequest = () => {
}
};

if (auth.pimsUser.data.Status && auth.pimsUser.data.Status === 'Active') {
if (auth.pimsUser.data && auth.pimsUser.data.Status === 'Active') {
return <Navigate replace to={'/'} />;
}

Expand All @@ -152,7 +152,7 @@ export const AccessRequest = () => {
<Typography mb={'2rem'} variant="h2">
{auth.pimsUser.data ? 'Access Pending' : 'Access Request'}
</Typography>
{auth.pimsUser.data.Status && auth.pimsUser.data.Status === 'OnHold' ? (
{auth.pimsUser.data && auth.pimsUser.data.Status === 'OnHold' ? (
<AccessPending />
) : (
<RequestForm submitHandler={onSubmit} />
Expand Down

0 comments on commit 90bb234

Please sign in to comment.