PteroTheme/resources/assets/scripts/store/index.ts

41 lines
1.2 KiB
TypeScript
Raw Normal View History

import Vue from 'vue';
2018-06-03 23:45:01 +01:00
import Vuex from 'vuex';
2018-12-16 23:29:44 +00:00
import auth, {AuthenticationState} from './modules/auth';
import dashboard, {DashboardState} from './modules/dashboard';
import server, {ServerState} from './modules/server';
import socket, {SocketState} from './modules/socket';
2018-06-03 23:45:01 +01:00
Vue.use(Vuex);
2018-12-16 23:29:44 +00:00
export type ApplicationState = {
socket: SocketState,
server: ServerState,
auth: AuthenticationState,
dashboard: DashboardState,
}
const store = new Vuex.Store({
2018-06-06 07:42:34 +01:00
strict: process.env.NODE_ENV !== 'production',
modules: {auth, dashboard, server, socket},
});
if (module.hot) {
module.hot.accept(['./modules/auth'], () => {
const newAuthModule = require('./modules/auth').default;
2018-07-16 01:53:40 +01:00
const newDashboardModule = require('./modules/dashboard').default;
const newServerModule = require('./modules/server').default;
const newSocketModule = require('./modules/socket').default;
store.hotUpdate({
modules: {
auth: newAuthModule,
dashboard: newDashboardModule,
server: newServerModule,
socket: newSocketModule
},
});
2018-06-03 23:45:01 +01:00
});
}
2018-06-03 23:45:01 +01:00
export default store;