Files
sase.tr/apps/web/src/routes/dashboard/settings_/$tab.tsx
Semih Yesilyurt 8e10ebc883 feat(web): redirect path-style /dashboard/settings/<tab> to ?tab= search param
Unsubscribe confirmations (and any stale links) used the path form which
had no route and fell to the SPA not-found screen.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 17:47:24 +03:00

15 lines
662 B
TypeScript

import { createFileRoute, redirect } from "@tanstack/react-router";
import { SETTINGS_TABS, type SettingsTab } from "../settings";
// Path-style deep links (e.g. /dashboard/settings/notifications from e-mail
// unsubscribe confirmations) — the settings page keys tabs off `?tab=`, so
// redirect there. Unknown segments fall back to the default tab.
export const Route = createFileRoute("/dashboard/settings_/$tab")({
beforeLoad: ({ params }) => {
const tab = SETTINGS_TABS.includes(params.tab as SettingsTab)
? (params.tab as SettingsTab)
: undefined;
throw redirect({ to: "/dashboard/settings", search: tab ? { tab } : {} });
},
});