12345678910111213141516 |
- export default function ({ store, req, redirect, route }) {
-
- if (process.server && !req) return
- if (!store.state.option.user.logged) {
- let ua = store.state.option.userAgent.toLowerCase()
- if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && req.url.indexOf('?code') === -1) {
-
- return redirect(`/mobile/wechat/toggle?url=${route.path}`)
- } else if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && req.url.indexOf('?code') > -1) {
-
- return redirect(`/mobile/wechat?url=${route.path}`)
- } else {
- return redirect(`/auth/login?returnUrl=${'http://' + req.headers.host + route.fullPath}`)
- }
- }
- }
|