2021-10-31 06:46:26 +08:00
|
|
|
import type { FlarumGenericRoute, RouteResolver } from '../Application';
|
|
|
|
import type Component from '../Component';
|
2021-05-13 07:29:46 +08:00
|
|
|
/**
|
|
|
|
* The `mapRoutes` utility converts a map of named application routes into a
|
|
|
|
* format that can be understood by Mithril, and wraps them in route resolvers
|
|
|
|
* to provide each route with the current route name.
|
|
|
|
*
|
|
|
|
* @see https://mithril.js.org/route.html#signature
|
|
|
|
*/
|
2021-10-31 06:46:26 +08:00
|
|
|
export default function mapRoutes(routes: Record<string, FlarumGenericRoute>, basePath?: string): Record<string, RouteResolver<Record<string, unknown>, Component<{
|
|
|
|
[key: string]: unknown;
|
|
|
|
routeName: string;
|
|
|
|
}, undefined>, Record<string, unknown>>>;
|