glhcp/pc/middleware/route.js

13 lines
406 B
JavaScript
Raw Normal View History

2023-08-10 06:59:52 +00:00
import Cookies from 'js-cookie'
const account = ['login', 'register', 'forget_pwd', "error"]
export default function({route, app, store}) {
const { fullPath } = route
const isAccount = account.some((item) => fullPath.includes(item))
const {isLogin} = store.getters
if(!isAccount && !isLogin) {
process.server ? app.$cookies.set('back_url', fullPath) : Cookies.set('back_url', fullPath)
}
}