Skip to content

Instantly share code, notes, and snippets.

@nshCore
Created October 13, 2016 15:14
Show Gist options
  • Save nshCore/7307347e407975a602c9d6d78db2662a to your computer and use it in GitHub Desktop.
Save nshCore/7307347e407975a602c9d6d78db2662a to your computer and use it in GitHub Desktop.
import App from './components/App.vue';
// Router
Vue.router = new VueRouter({
hashbang: false,
history: true,
linkActiveClass: 'active',
mode: 'html5'
});
Vue.router.map({
'/': {
name: 'default',
component: require('./components/pages/Home.vue')
},
'/login': {
auth: false,
name: 'login',
component: require('./components/pages/Login.vue')
},
'/login/:type': {
name: 'oauth2-type',
component: require('./components/pages/Oauth2.vue')
},
'/register': {
auth: false,
name: 'register',
component: require('./components/pages/Register.vue')
},
'/oauth1': {
name: 'oauth1',
component: require('./components/pages/Oauth1.vue')
},
'/oauth2': {
name: 'oauth2',
component: require('./components/pages/Oauth2.vue')
},
'/account': {
auth: true,
name: 'account',
component: require('./components/pages/Account.vue')
},
'/admin': {
auth: 'admin',
name: 'admin',
component: require('./components/pages/Admin.vue')
},
'/users': {
auth: ['admin'],
name: 'users',
component: require('./components/pages/Users.vue')
},
'/404': {
name: 'error-404',
component: require('./components/pages/404.vue')
},
'/403': {
name: 'error-403',
component: require('./components/pages/403.vue')
},
'/list': {
name: 'list',
component: require('./components/pages/LinkList.vue')
},
'/find': {
auth: true,
name: 'find',
component: require('./components/pages/Find.vue')
}
});
// Http
Vue.http.options.root = 'http://api.dev';
// Vue Auth
Vue.use(require('../../src/index.js'), {
rolesVar: 'role',
facebookOauth2Data: {
clientId: '196729390739201'
},
googleOauth2Data: {
clientId: '337636458732-tatve7q4qo4gnpfcenbv3i47id4offbg.apps.googleusercontent.com'
}
});
// Start
Vue.router.start(App, '#app');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment