pleroma-fe/src/main.js

72 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-10-26 14:46:32 +00:00
import Vue from 'vue'
2016-10-26 17:03:55 +00:00
import VueRouter from 'vue-router'
import Vuex from 'vuex'
2018-09-09 16:36:13 +00:00
import interfaceModule from './modules/interface.js'
2018-09-09 18:21:23 +00:00
import instanceModule from './modules/instance.js'
2016-10-27 16:03:25 +00:00
import statusesModule from './modules/statuses.js'
import usersModule from './modules/users.js'
import apiModule from './modules/api.js'
import configModule from './modules/config.js'
2017-12-05 10:47:10 +00:00
import chatModule from './modules/chat.js'
2018-10-26 13:16:23 +00:00
import oauthModule from './modules/oauth.js'
2016-10-26 17:03:55 +00:00
import VueTimeago from 'vue-timeago'
2017-11-07 14:14:37 +00:00
import VueI18n from 'vue-i18n'
import createPersistedState from './lib/persisted_state.js'
2017-02-14 21:42:13 +00:00
2017-11-07 14:14:37 +00:00
import messages from './i18n/messages.js'
2018-01-26 14:11:34 +00:00
import VueChatScroll from 'vue-chat-scroll'
2018-10-26 13:16:23 +00:00
import afterStoreSetup from './boot/after_store.js'
2017-11-08 20:18:42 +00:00
const currentLocale = (window.navigator.language || 'en').split('-')[0]
2016-10-26 17:03:55 +00:00
Vue.use(Vuex)
Vue.use(VueRouter)
Vue.use(VueTimeago, {
locale: currentLocale === 'ja' ? 'ja' : 'en',
locales: {
2017-11-08 20:18:42 +00:00
'en': require('../static/timeago-en.json'),
'ja': require('../static/timeago-ja.json')
}
})
2017-11-07 14:14:37 +00:00
Vue.use(VueI18n)
2018-01-26 14:11:34 +00:00
Vue.use(VueChatScroll)
2016-10-26 17:03:55 +00:00
2017-11-07 14:14:37 +00:00
const i18n = new VueI18n({
// By default, use the browser locale, we will update it if neccessary
2017-11-07 14:23:00 +00:00
locale: currentLocale,
2017-11-07 14:14:37 +00:00
fallbackLocale: 'en',
messages
})
2018-10-26 13:16:23 +00:00
const persistedStateOptions = {
paths: [
'config',
'users.lastLoginName',
'oauth'
]
}
createPersistedState(persistedStateOptions).then((persistedState) => {
const store = new Vuex.Store({
modules: {
interface: interfaceModule,
instance: instanceModule,
statuses: statusesModule,
users: usersModule,
api: apiModule,
config: configModule,
chat: chatModule,
oauth: oauthModule
},
plugins: [persistedState],
strict: false // Socket modifies itself, let's ignore this for now.
// strict: process.env.NODE_ENV !== 'production'
2018-02-03 15:27:33 +00:00
})
2018-10-26 13:16:23 +00:00
afterStoreSetup({store, i18n})
})