-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: redirect users to login when endpoint throws a 4XX status (#99)
* feat: redirect users to login when endpoint throws a 4XX status * adding a error map of messages. Fix for home to sign in if endpoint is returning 4XX * fix: home page to route to sign in page * add login page if loader is 400 * Edits to message being sent to login page is controlled in a map instead of hard coded * removed status from testing and added a state to have the latest datacall * changing hardcoded error messages for userTable to dynamic error messages
- Loading branch information
Showing
9 changed files
with
352 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Box, Typography } from '@mui/material' | ||
import { Button as CmsButton } from '@cmsgov/design-system' | ||
import { useLocation } from 'react-router-dom' | ||
|
||
export default function LoginPage() { | ||
const location = useLocation() | ||
const message = location.state?.message || '' | ||
return ( | ||
<Box | ||
flex={1} | ||
sx={{ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
height: '50vh', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<Typography variant="h4" sx={{ mb: 2 }}> | ||
{message} | ||
</Typography> | ||
<CmsButton href="/login">Login</CmsButton> | ||
</Box> | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.