Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public render () {
- const { axiosError } = this.state
- return (
- {axiosError &&
- withAxiosErrorHandled(axiosError)(Alert)
- }
- )
- }
- export const AlertWithAxiosErrorHandled = (axiosError: AxiosError) => {
- let text
- const { code, response } = axiosError
- if (response) {
- switch (code) {
- case '404':
- text = AppConfig.messages[404]
- break
- default:
- text = AppConfig.messages.default
- }
- } else {
- text = AppConfig.messages.default
- }
- return <Alert text={text} />
Add Comment
Please, Sign In to add comment