kopia lustrzana https://github.com/Tldraw/Tldraw
create redirects
rodzic
42846e2969
commit
c9d944c5eb
|
@ -6,6 +6,10 @@ exports[`the_routes 1`] = `
|
|||
"reactRouterPattern": "/",
|
||||
"vercelRouterPattern": "^//?$",
|
||||
},
|
||||
{
|
||||
"reactRouterPattern": "/new",
|
||||
"vercelRouterPattern": "^/new/?$",
|
||||
},
|
||||
{
|
||||
"reactRouterPattern": "/r",
|
||||
"vercelRouterPattern": "^/r/?$",
|
||||
|
|
|
@ -111,6 +111,7 @@ test('all React routes match', () => {
|
|||
test("non-react routes don't match", () => {
|
||||
// lil smoke test for basic patterns
|
||||
expect('/').toMatchAny(allvercelRouterPatterns)
|
||||
expect('/new').toMatchAny(allvercelRouterPatterns)
|
||||
expect('/r/whatever').toMatchAny(allvercelRouterPatterns)
|
||||
expect('/r/whatever/').toMatchAny(allvercelRouterPatterns)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { captureException } from '@sentry/react'
|
||||
import { nanoid } from 'nanoid'
|
||||
import { useEffect } from 'react'
|
||||
import { createRoutesFromElements, Outlet, redirect, Route, useRouteError } from 'react-router-dom'
|
||||
import { createRoutesFromElements, Navigate, Outlet, Route, useRouteError } from 'react-router-dom'
|
||||
import { DefaultErrorFallback } from './components/DefaultErrorFallback/DefaultErrorFallback'
|
||||
import { ErrorPage } from './components/ErrorPage/ErrorPage'
|
||||
|
||||
|
@ -30,13 +29,8 @@ export const router = createRoutesFromElements(
|
|||
>
|
||||
<Route errorElement={<DefaultErrorFallback />}>
|
||||
<Route path="/" lazy={() => import('./pages/root')} />
|
||||
<Route
|
||||
path="/r"
|
||||
loader={() => {
|
||||
const id = 'v2' + nanoid()
|
||||
return redirect(`/r/${id}`)
|
||||
}}
|
||||
/>
|
||||
<Route path="/r" element={<Navigate to="/" />} />
|
||||
<Route path="/new" element={<Navigate to="/" />} />
|
||||
<Route path="/r/:roomId" lazy={() => import('./pages/public-multiplayer')} />
|
||||
<Route path="/r/:boardId/history" lazy={() => import('./pages/history')} />
|
||||
<Route
|
||||
|
|
Ładowanie…
Reference in New Issue