Begin transfering things to TS
This commit is contained in:
parent
81f5e49768
commit
3ad4422a94
17 changed files with 280 additions and 138 deletions
40
resources/assets/scripts/store/index.ts
Normal file
40
resources/assets/scripts/store/index.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import auth, {AuthenticationState} from './modules/auth';
|
||||
import dashboard, {DashboardState} from './modules/dashboard';
|
||||
import server, {ServerState} from './modules/server';
|
||||
import socket, {SocketState} from './modules/socket';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export type ApplicationState = {
|
||||
socket: SocketState,
|
||||
server: ServerState,
|
||||
auth: AuthenticationState,
|
||||
dashboard: DashboardState,
|
||||
}
|
||||
|
||||
const store = new Vuex.Store({
|
||||
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;
|
||||
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
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default store;
|
Loading…
Add table
Add a link
Reference in a new issue