fix: serve board directly at /:slug without redirect
Changed catch-all route to render Board component directly instead of redirecting to /board/:slug/. Now canvas.jeffemmett.com/ccc shows the board without changing the URL. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
80f457f615
commit
b8f179c9c1
24
src/App.tsx
24
src/App.tsx
|
|
@ -119,14 +119,6 @@ const RedirectBoardSlug = () => {
|
|||
return <Navigate to={`/board/${slug}/`} replace />;
|
||||
};
|
||||
|
||||
/**
|
||||
* Component to redirect direct slug URLs to board URLs
|
||||
* Handles canvas.jeffemmett.com/ccc → /board/ccc/
|
||||
*/
|
||||
const RedirectDirectSlug = () => {
|
||||
const { slug } = useParams<{ slug: string }>();
|
||||
return <Navigate to={`/board/${slug}/`} replace />;
|
||||
};
|
||||
|
||||
/**
|
||||
* Main App with context providers
|
||||
|
|
@ -223,11 +215,19 @@ const AppWithProviders = () => {
|
|||
<Route path="/google" element={<GoogleDataTest />} />
|
||||
<Route path="/oauth/google/callback" element={<GoogleDataTest />} />
|
||||
|
||||
{/* Catch-all: Direct slug URLs redirect to board URLs */}
|
||||
{/* e.g., canvas.jeffemmett.com/ccc → /board/ccc/ */}
|
||||
{/* Catch-all: Direct slug URLs serve board directly */}
|
||||
{/* e.g., canvas.jeffemmett.com/ccc → shows board "ccc" */}
|
||||
{/* Must be LAST to not interfere with other routes */}
|
||||
<Route path="/:slug" element={<RedirectDirectSlug />} />
|
||||
<Route path="/:slug/" element={<RedirectDirectSlug />} />
|
||||
<Route path="/:slug" element={
|
||||
<OptionalAuthRoute>
|
||||
<Board />
|
||||
</OptionalAuthRoute>
|
||||
} />
|
||||
<Route path="/:slug/" element={
|
||||
<OptionalAuthRoute>
|
||||
<Board />
|
||||
</OptionalAuthRoute>
|
||||
} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</BrowserRouter>
|
||||
|
|
|
|||
Loading…
Reference in New Issue