guhongwei il y a 4 ans
Parent
commit
5278609dd3
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  1. 9 0
      src/router/before.js

+ 9 - 0
src/router/before.js

@@ -0,0 +1,9 @@
+import store from '@/store/index';
+
+const checkLogin = (router, func) => {
+  router.beforeEach(async (to, form, next) => {
+    let res = await store.dispatch('login/toGetUser', func ? func : null);
+    next();
+  });
+};
+export default checkLogin;