Guest User

Untitled

a guest
Mar 14th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import router from './router'
  4. import axios from 'axios'
  5. import VueAxios from 'vue-axios'
  6.  
  7. axios.defaults.baseURL = 'http://localhost:3000'
  8. axios.defaults.headers.common['Authorization'] = "Bearer" + localStorage.getItem('jwtToken')
  9.  
  10. Vue.use(VueAxios, axios)
  11.  
  12. router.beforeEach((to, from, next) => {
  13. if (to.meta.requiresAuth) {
  14. if (**O QUE COLOCO AQUI SEM UTILIZAR O VUEX?**) {
  15. next()
  16. } else {
  17. next('/')
  18. }
  19. } else {
  20. next()
  21. }
  22. })
  23.  
  24. new Vue({
  25. el: '#app',
  26. router,
  27. axios,
  28. render: h => h(App)
  29. })
Add Comment
Please, Sign In to add comment