2023-12-01 17:57:14 +00:00
|
|
|
import { useAuthStore } from '../stores/auth';
|
2022-09-20 19:59:52 +00:00
|
|
|
import Cookies from 'js-cookie'
|
|
|
|
|
|
|
|
export default async (to, from, next) => {
|
2023-12-01 17:57:14 +00:00
|
|
|
const authStore = useAuthStore()
|
|
|
|
if (!authStore.check) {
|
2022-09-20 19:59:52 +00:00
|
|
|
Cookies.set('intended_url', to.path)
|
|
|
|
|
|
|
|
next({ name: 'login' })
|
|
|
|
} else {
|
|
|
|
next()
|
|
|
|
}
|
|
|
|
}
|