mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: handle 404 on unknown top level routes (#10964)
This commit is contained in:
+22
-24
@@ -320,26 +320,29 @@ export const AppRouter: FC = () => {
|
||||
</Route>
|
||||
</Route>
|
||||
|
||||
<Route path="/:username">
|
||||
<Route path=":workspace">
|
||||
<Route index element={<WorkspacePage />} />
|
||||
<Route
|
||||
path="builds/:buildNumber"
|
||||
element={<WorkspaceBuildPage />}
|
||||
/>
|
||||
<Route path="settings" element={<WorkspaceSettingsLayout />}>
|
||||
<Route index element={<WorkspaceSettingsPage />} />
|
||||
<Route
|
||||
path="parameters"
|
||||
element={<WorkspaceParametersPage />}
|
||||
/>
|
||||
<Route
|
||||
path="schedule"
|
||||
element={<WorkspaceSchedulePage />}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
{/* In order for the 404 page to work properly the routes that start with
|
||||
top level parameter must be fully qualified. */}
|
||||
<Route path="/:username/:workspace" element={<WorkspacePage />} />
|
||||
<Route
|
||||
path="/:username/:workspace/builds/:buildNumber"
|
||||
element={<WorkspaceBuildPage />}
|
||||
/>
|
||||
<Route
|
||||
path="/:username/:workspace/settings"
|
||||
element={<WorkspaceSettingsLayout />}
|
||||
>
|
||||
<Route index element={<WorkspaceSettingsPage />} />
|
||||
<Route
|
||||
path="parameters"
|
||||
element={<WorkspaceParametersPage />}
|
||||
/>
|
||||
<Route path="schedule" element={<WorkspaceSchedulePage />} />
|
||||
</Route>
|
||||
|
||||
{/* Using path="*"" means "match anything", so this route
|
||||
acts like a catch-all for URLs that we don't have explicit
|
||||
routes for. */}
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Route>
|
||||
|
||||
{/* Pages that don't have the dashboard layout */}
|
||||
@@ -354,11 +357,6 @@ export const AppRouter: FC = () => {
|
||||
element={<TemplateVersionEditorPage />}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
{/* Using path="*"" means "match anything", so this route
|
||||
acts like a catch-all for URLs that we don't have explicit
|
||||
routes for. */}
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
</Suspense>
|
||||
|
||||
Reference in New Issue
Block a user