forked from Shiloh/remnantchat
feat: redirect invalid routes to root
This commit is contained in:
parent
95d6ed6f11
commit
9f0d20cd22
@ -1,5 +1,10 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
|
import {
|
||||||
|
BrowserRouter as Router,
|
||||||
|
Routes,
|
||||||
|
Route,
|
||||||
|
Navigate,
|
||||||
|
} from 'react-router-dom'
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
import localforage from 'localforage'
|
import localforage from 'localforage'
|
||||||
|
|
||||||
@ -119,6 +124,10 @@ function Bootstrap({
|
|||||||
path={routes.PRIVATE_ROOM}
|
path={routes.PRIVATE_ROOM}
|
||||||
element={<PrivateRoom userId={userId} />}
|
element={<PrivateRoom userId={userId} />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="*"
|
||||||
|
element={<Navigate to={routes.ROOT} replace />}
|
||||||
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
|
Loading…
Reference in New Issue
Block a user