fix(cli): incorrect route redirect config

This commit is contained in:
chenjiahan 2020-11-27 16:12:15 +08:00
parent a4a96d7146
commit 8a4690a1d2
2 changed files with 12 additions and 4 deletions

View File

@ -49,13 +49,17 @@ function getRoutes() {
routes.push({ routes.push({
name: 'notFound', name: 'notFound',
path: '/:path(.*)+', path: '/:path(.*)+',
redirect: (route) => `/${getLangFromRoute(route)}/`, redirect: (route) => ({
name: getLangFromRoute(route),
}),
}); });
} else { } else {
routes.push({ routes.push({
name: 'notFound', name: 'notFound',
path: '/:path(.*)+', path: '/:path(.*)+',
redirect: '/', redirect: {
name: 'home',
},
}); });
} }

View File

@ -30,7 +30,9 @@ function getRoutes() {
routes.push({ routes.push({
name: 'NotFound', name: 'NotFound',
path: '/:path(.*)+', path: '/:path(.*)+',
redirect: (route) => `/${getLangFromRoute(route)}/`, redirect: (route) => ({
name: getLangFromRoute(route),
}),
}); });
langs.forEach((lang) => { langs.forEach((lang) => {
@ -45,7 +47,9 @@ function getRoutes() {
routes.push({ routes.push({
name: 'NotFound', name: 'NotFound',
path: '/:path(.*)+', path: '/:path(.*)+',
redirect: () => '/', redirect: {
name: 'home',
},
}); });
routes.push({ routes.push({