Files
docmost/apps/client/src/lib/app-route.ts
T
Philip Okugbe d42091ccb1 feat: favorites (#2103)
* feat: favorites and templates(ee)

* rename migrations

* fix sidebar

* cleanup tabs

* fix

* turn off templates

* cleanup

* uuid validation
2026-04-12 22:06:25 +01:00

51 lines
1.3 KiB
TypeScript

const APP_ROUTE = {
HOME: "/home",
SPACES: "/spaces",
FAVORITES: "/favorites",
SEARCH: "/search",
AUTH: {
LOGIN: "/login",
SIGNUP: "/signup",
SETUP: "/setup/register",
FORGOT_PASSWORD: "/forgot-password",
PASSWORD_RESET: "/password-reset",
CREATE_WORKSPACE: "/create",
SELECT_WORKSPACE: "/select",
MFA_CHALLENGE: "/login/mfa",
MFA_SETUP_REQUIRED: "/login/mfa/setup",
VERIFY_EMAIL: "/verify-email",
},
SETTINGS: {
ACCOUNT: {
PROFILE: "/settings/account/profile",
PREFERENCES: "/settings/account/preferences",
},
WORKSPACE: {
GENERAL: "/settings/workspace",
MEMBERS: "/settings/members",
GROUPS: "/settings/groups",
SPACES: "/settings/spaces",
BILLING: "/settings/billing",
SECURITY: "/settings/security",
},
},
};
export function getPostLoginRedirect(): string {
const params = new URLSearchParams(window.location.search);
const redirect = params.get("redirect");
if (redirect) {
try {
const resolved = new URL(redirect, window.location.origin);
if (resolved.origin === window.location.origin) {
return resolved.pathname + resolved.search + resolved.hash;
}
} catch {
// malformed URL, fall through to default
}
}
return APP_ROUTE.HOME;
}
export default APP_ROUTE;