"src/src/main.js" did not exist on "3f9b6187164b52d52fa4cc94272c673ca9e92ac4"
main.js 1.56 KB
Newer Older
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
1 2 3 4 5
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import vuetify from './plugins/vuetify'
import './plugins'
6
import Vuex from 'vuex'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
7
import Toast from 'vue-toastification'
Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
8
import store from '@/store'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
9
import Vuebar from 'vuebar'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
10
import 'vue-toastification/dist/index.css'
Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
11
import axios from 'axios'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
12 13
import api from '@/utils/api'
import { encrypt } from './utils/enc'
14
import MultiFiltersPlugin from '@/plugins/MultiFilters'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
15

Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
16
Vue.use(Vuex)
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
17

Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
18 19 20
Vue.config.productionTip = false
Vue.use(Vuebar)

krlsnvz93's avatar
krlsnvz93 committed
21 22
Vue.use(MultiFiltersPlugin)

Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
23 24
Vue.prototype.$axios = api

Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
25
/* if (process.env.NODE_ENV === 'development') {
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
26 27
  const { worker } = require('./mocks/browser')
  worker.start()
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
28
} */
krlsnvz93's avatar
krlsnvz93 committed
29

Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
30 31 32 33 34
Vue.use(Toast, {
  transition: 'Vue-Toastification__bounce',
  maxToasts: 20,
  newestOnTop: true,
})
35
// CHECK SECURITY
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
36
router.beforeEach((to, from, next) => {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
37
  if (to.name !== 'Login' && localStorage.getItem('tkn') === 'null') {
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51
    Vue.$toast.error('Debe estar logueado para poder navegar en nuestro sitio', {
      position: 'bottom-center',
      timeout: 5000,
      closeOnClick: true,
      pauseOnFocusLoss: false,
      pauseOnHover: true,
      draggable: true,
      draggablePercent: 0.6,
      showCloseButtonOnHover: false,
      hideProgressBar: true,
      closeButton: 'button',
      icon: true,
      rtl: false,
    })
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
52
    router.push({ name: 'Login' })
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
53 54
  } else if (to.name === 'Login' && localStorage.getItem('tkn') !== 'null') {
    next({ name: 'Control' })
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
55 56
  } else {
    next()
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
57
  }
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
58
})
krlsnvz93's avatar
krlsnvz93 committed
59 60

new Vue({
Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
61 62 63 64 65
  axios,
  router,
  store,
  vuetify,
  render: h => h(App),
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
66
}).$mount('#app')