authorited.js 284 B

123456789
  1. export default function ({ store, req, redirect, route }) {
  2. // If nuxt generate, pass this middleware
  3. if (process.server && !req) return
  4. if (!store.state.option.user.logged) {
  5. return redirect(`/auth/login?returnUrl=${'http://' + req.headers.host + route.fullPath}`)
  6. }
  7. }