@withstudiocms/internal_helpers
Version:
Internal helper utilities for StudioCMS
16 lines (15 loc) • 772 B
TypeScript
/**
* Creates a URL generator factory function with a default dashboard route.
*
* The returned `urlGenFactory` function generates URLs based on whether the route is a dashboard route,
* an optional path, and an optional dashboard route override.
*
* @param defaultDashboardRoute - The default base route for dashboard URLs.
* @returns A factory function that generates URLs based on the provided parameters.
*
* @example
* const urlGen = createURLGenFactory('dashboard');
* urlGen(true, 'settings'); // Returns '/dashboard/settings'
* urlGen(false, 'about'); // Returns '/about'
*/
export declare function createURLGenFactory(defaultDashboardRoute: string): (isDashboardRoute: boolean, path: string | undefined, DashboardRouteOverride?: string) => string;