-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement navigate to 404 error page when accessing non-existent URL …
…in workspaceSlug (#244) * Add 404 NotFound Page * Add query error exception handling condition * Navigate to page 404 according to error conditions * Fix to Specify specific error code * Add error and loading conditions * Move to Global Logic of axios Error status * Remove Logic of Axios Error * Comment to change it to navigate * Move File hooks to utils * Fix: CustomNavigate * Revert "Fix: CustomNavigate" This reverts commit 3a48e1e. * Fix customNavigate to window.location.href * Remove customNavigate * Rebase: Code Conflict
- Loading branch information
Showing
6 changed files
with
95 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Box, Typography, Button } from "@mui/material"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const NotFound = () => { | ||
const navigate = useNavigate(); | ||
|
||
const handleGoHome = () => { | ||
navigate("/"); | ||
}; | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height: "100vh", | ||
width: "100vw", | ||
textAlign: "center", | ||
bgcolor: "background.default", | ||
color: "text.primary", | ||
p: 3, | ||
}} | ||
> | ||
<Typography variant="h1" component="h1" gutterBottom> | ||
404 | ||
</Typography> | ||
<Typography variant="h5" component="p" gutterBottom> | ||
Page Not Found | ||
</Typography> | ||
<Typography variant="body1" component="p" gutterBottom> | ||
The page you are looking for does not exist. | ||
</Typography> | ||
<Button variant="contained" color="primary" onClick={handleGoHome} sx={{ mt: 2 }}> | ||
Go to Home | ||
</Button> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default NotFound; |
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,9 @@ | ||
import { AxiosError } from "axios"; | ||
|
||
export const isAxios404Error = (error: unknown): boolean => { | ||
return error instanceof AxiosError && error.response?.status === 404; | ||
}; | ||
|
||
export const isAxios500Error = (error: unknown): boolean => { | ||
return error instanceof AxiosError && error.response?.status === 500; | ||
}; |