before.js 246 B

123456789
  1. import store from '@/store/index';
  2. const checkLogin = (router, func) => {
  3. router.beforeEach(async (to, form, next) => {
  4. let res = await store.dispatch('login/toGetUser', func ? func : null);
  5. next();
  6. });
  7. };
  8. export default checkLogin;