opnform/resources/js/middleware/auth.js

13 lines
240 B
JavaScript
Raw Normal View History

2022-09-20 19:59:52 +00:00
import store from '~/store'
import Cookies from 'js-cookie'
export default async (to, from, next) => {
if (!store.getters['auth/check']) {
Cookies.set('intended_url', to.path)
next({ name: 'login' })
} else {
next()
}
}