|
@@ -43,10 +43,25 @@ router.beforeEach((to, from, next) => {
|
|
|
const roles = res
|
|
|
|
|
|
if (roles.permissionList.length == 0 || !roles) {
|
|
|
- store.dispatch('Logout').then(() => {
|
|
|
- store.dispatch('ResetRoutes').then(() => {
|
|
|
- next({ path: '/user/login', query: { redirect: to.fullPath } })
|
|
|
- })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ store.dispatch('GenerateRoutes', { roles }).then(() => {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const redirect = decodeURIComponent(from.query.redirect || to.path)
|
|
|
+ if (to.path === redirect) {
|
|
|
+
|
|
|
+ next()
|
|
|
+ } else {
|
|
|
+
|
|
|
+ next({ path: redirect })
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
store.dispatch('GenerateRoutes', { roles }).then(() => {
|