import Vue from 'vue'
import VueI18n from 'vue-i18n'
import App from './App.vue'
import router from './router'
import store from './store'
import './styles/index.scss'
import 'bulma-checkradio'
import './registerServiceWorker'
import filters from './utils/filters'
import './utils/icons'
import messages from './messages'

Vue.use(VueI18n)

Vue.config.productionTip = false

for (const filter of Object.keys(filters)) {
  Vue.filter(filter, filters[filter])
}

const i18n = new VueI18n({
  locale: 'fr',
  fallbackLocale: 'en',
  messages
})

const app = async () => {
  await store.dispatch('retrieveUser')
  new Vue({
    router,
    store,
    i18n,
    render: (h) => h(App)
  }).$mount('#app')
}

app()
