daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import store from '@state/store'
  2.  
  3. export default [
  4.   {
  5.     path: '/',
  6.     name: 'home',
  7.     component: require('@views/home').default,
  8.   },
  9.   {
  10.     path: '/login',
  11.     name: 'login',
  12.     component: require('@views/login').default,
  13.     beforeEnter(routeTo, routeFrom, next) {
  14.       // If the user is already logged in
  15.       if (store.getters['auth/loggedIn']) {
  16.         // Redirect to the home page instead
  17.         next({ name: 'home' })
  18.       } else {
  19.         // Continue to the login page
  20.         next()
  21.       }
  22.     },
  23.   },
  24.   // ...
  25. }
RAW Paste Data
Top