INNER CODE UNIT · TypeScript
sanitizeRouterBase
heymrun/heym · frontend/src/router/index.ts:5
function sanitizeRouterBase(raw: unknown): string {
if (typeof raw !== "string" || raw === "undefined" || raw === "null") {
return "/";
}
const trimmed = raw.trim();
if (trimmed === "") {
return "/";
}
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
}
// Dashboard tabs are query-driven (`/?tab=<name>`). Expose friendly path aliases
// (e.g. `/mcp`, `/drive`) that redirect to the matching dashboard tab so links and
// manual URLs land on the right place.
const DASHBOARD_TAB_PATHS = [
"schedules",
"credentials",
"globalvariables",