feat: added not-found and error pages
This commit is contained in:
+17
-12
@@ -6,24 +6,26 @@ import { ServerContext } from './hooks'
|
||||
import { UserProvider } from './hooks/useCurrentUser'
|
||||
|
||||
import { AdminPage } from './pages/AdminPage'
|
||||
import { ErrorPage } from './pages/ErrorPage'
|
||||
import { HomePage } from './pages/HomePage'
|
||||
import { LoginPage } from './pages/LoginPage'
|
||||
import { NotFoundPage } from './pages/NotFoundPage'
|
||||
import { ProblemPage } from './pages/ProblemPage'
|
||||
import { ProfilePage } from './pages/ProfilePage'
|
||||
import { ScoresPage } from './pages/ScoresPage'
|
||||
import { UserPage } from './pages/UserPage'
|
||||
|
||||
const Redirect = ({ to }: { to: string }) => {
|
||||
useEffect(() => {
|
||||
route(prependBaseUrl(to), true)
|
||||
}, [])
|
||||
// const Redirect = ({ to }: { to: string }) => {
|
||||
// useEffect(() => {
|
||||
// route(prependBaseUrl(to), true)
|
||||
// }, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
Redirecting to <pre>{to}</pre>...
|
||||
</>
|
||||
)
|
||||
}
|
||||
// return (
|
||||
// <>
|
||||
// Redirecting to <pre>{to}</pre>...
|
||||
// </>
|
||||
// )
|
||||
// }
|
||||
|
||||
export const App = ({ url }: { url?: string }) => {
|
||||
// during server side rendering don't prepend the BASE_URL
|
||||
@@ -60,10 +62,13 @@ export const App = ({ url }: { url?: string }) => {
|
||||
// @ts-ignore
|
||||
path={pbu('/scores')}
|
||||
/>
|
||||
<Redirect
|
||||
<ErrorPage
|
||||
// @ts-ignore
|
||||
path={pbu('/error')}
|
||||
/>
|
||||
<NotFoundPage
|
||||
// @ts-ignore
|
||||
default
|
||||
to="/"
|
||||
/>
|
||||
</Router>
|
||||
</UserProvider>
|
||||
|
||||
Reference in New Issue
Block a user