Skip to content

Instantly share code, notes, and snippets.

@santiblanko
Created August 8, 2019 19:44
Show Gist options
  • Save santiblanko/5aff2110432f6d3b5c56e312175ce811 to your computer and use it in GitHub Desktop.
Save santiblanko/5aff2110432f6d3b5c56e312175ce811 to your computer and use it in GitHub Desktop.
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
Vue.config.productionTip = true
Vue.router = router
import ElementUI from 'element-ui';
import VueInstant from 'vue-instant'
import '../static/assets/css/dashmix.min.css'
import 'bootstrap/dist/css/bootstrap.css';
import 'vue-instant/dist/vue-instant.css'
import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css';
import 'element-ui/lib/theme-chalk/index.css';
import locale from 'element-ui/lib/locale/lang/es'
import axios from 'axios'
import VueAxios from 'vue-axios'
import VueAuth from '@websanova/vue-auth'
Vue.use(VueAxios, axios)
Vue.axios.defaults.baseURL = window.configGisWorker.baseURL
Vue.use(VueAuth, {
http: require('@websanova/vue-auth/drivers/http/axios.1.x.js'),
router: require('@websanova/vue-auth/drivers/router/vue-router.2.x.js'),
loginData: {
url: '/auth/local',
method: 'POST',
fetchUser: false
},
authRedirect: {path: '/login'},
auth: {
request: function (req, token) {
if (req.url == "/auth/local" || req.url == "/auth/local/register") {
req.headers['Authorization'] = null;
} else {
req.headers['Authorization'] = 'Bearer ' + token;
}
},
response: function (res) {
if(res.data.jwt)
return res.data.jwt
}
},
fetchData: { enabled: false },
refreshData: { enabled: false }
});
const moment = require('moment')
require('moment/locale/es')
Vue.use(require('vue-moment'), {
moment
})
Vue.use(VueInstant)
Vue.use(ElementUI, {
locale
});
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment