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;