mirror of
https://github.com/flarum/framework.git
synced 2025-05-22 22:59:57 +08:00
Support running in subdirectory with base_path config
This commit is contained in:
@ -4,9 +4,10 @@
|
||||
*
|
||||
* @see https://lhorie.github.io/mithril/mithril.route.html#defining-routes
|
||||
* @param {Object} routes
|
||||
* @param {String} [basePath]
|
||||
* @return {Object}
|
||||
*/
|
||||
export default function mapRoutes(routes) {
|
||||
export default function mapRoutes(routes, basePath = '') {
|
||||
const map = {};
|
||||
|
||||
for (const key in routes) {
|
||||
@ -14,7 +15,7 @@ export default function mapRoutes(routes) {
|
||||
|
||||
if (route.component) route.component.props.routeName = key;
|
||||
|
||||
map[route.path] = route.component;
|
||||
map[basePath + route.path] = route.component;
|
||||
}
|
||||
|
||||
return map;
|
||||
|
Reference in New Issue
Block a user