-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle http response 403 forbiden error (#522)
- Add interceptors for 'Axios' to handle error responses 403 automatically - Navigate to error page with message details when receiving 403 forbidden response
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Card, Typography } from "antd"; | ||
import { useParams } from "react-router-dom"; | ||
|
||
const { Title } = Typography; | ||
|
||
const ResponseErrors: React.FC = () => { | ||
const { status, detail } = useParams(); | ||
switch (status) { | ||
case "403": | ||
return ( | ||
<div className="page"> | ||
<Card style={{ minWidth: "1000px" }}> | ||
<Title level={3}> ERROR 403</Title> | ||
ACCESS NOT GRANTED | ||
<Card>{detail}</Card> | ||
</Card> | ||
</div> | ||
); | ||
|
||
default: | ||
return ( | ||
<div className="page"> | ||
<Card style={{ minWidth: "1000px" }}> | ||
<Title level={3}>Unknown Error</Title> | ||
</Card> | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default ResponseErrors; |