Skip to content

Commit

Permalink
add error type to not found page to satisfy ts (#31)
Browse files Browse the repository at this point in the history
* add error type to not found page to satisfy ts

* Add netlify redirects

* Move redirects to public
  • Loading branch information
jwu910 authored Dec 20, 2023
1 parent 5c42c54 commit 36d102d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Local Netlify folder
.netlify
2 changes: 2 additions & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* /index.html 200

15 changes: 11 additions & 4 deletions src/views/ErrorPage/NotFoundPage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { useRouteError } from 'react-router-dom'

type TError = {
statusText: string
message: string
}

export default function NotFoundPage() {
const error: Record<string, string> | unknown = useRouteError()
const error = useRouteError() as TError
console.error(error)

return (
<div id="error-page">
<h1>Oops!</h1>
<p>Sorry, an unexpected error has occurred.</p>
<p>
<i>{error.statusText || error.message}</i>
</p>
{error && (
<p>
<i>{error?.statusText || error?.message}</i>
</p>
)}
</div>
)
}

0 comments on commit 36d102d

Please sign in to comment.