feat: redirect invalid routes to root

This commit is contained in:
Jeremy Kahn 2022-10-29 13:09:27 -05:00
parent 95d6ed6f11
commit 9f0d20cd22

View File

@ -1,5 +1,10 @@
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 localforage from 'localforage'
@ -119,6 +124,10 @@ function Bootstrap({
path={routes.PRIVATE_ROOM}
element={<PrivateRoom userId={userId} />}
/>
<Route
path="*"
element={<Navigate to={routes.ROOT} replace />}
/>
</Routes>
) : (
<></>