Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Vue from 'vue'
- import App from './App.vue'
- import router from './router'
- import axios from 'axios'
- import VueAxios from 'vue-axios'
- axios.defaults.baseURL = 'http://localhost:3000'
- axios.defaults.headers.common['Authorization'] = "Bearer" + localStorage.getItem('jwtToken')
- Vue.use(VueAxios, axios)
- router.beforeEach((to, from, next) => {
- if (to.meta.requiresAuth) {
- if (**O QUE COLOCO AQUI SEM UTILIZAR O VUEX?**) {
- next()
- } else {
- next('/')
- }
- } else {
- next()
- }
- })
- new Vue({
- el: '#app',
- router,
- axios,
- render: h => h(App)
- })
Add Comment
Please, Sign In to add comment