import { createLogger, createStore } from "vuex";
|
|
import { GenericStore } from "./generics";
|
|
import { getters, GettersTypes } from "./getters";
|
|
|
|
// Import store information
|
|
import { state, IState } from "./state";
|
|
import { mutations, MutationsTypes } from "./mutations";
|
|
import { actions, ActionsTypes } from "./actions";
|
|
|
|
// Export store keys
|
|
export { Mutation } from "./mutations";
|
|
export { Action } from "./actions";
|
|
|
|
/**
|
|
* The the store type
|
|
*/
|
|
export type Store = GenericStore<IState, GettersTypes, MutationsTypes, ActionsTypes>;
|
|
|
|
/**
|
|
* Create the store instance
|
|
*/
|
|
const store = createStore({
|
|
state, getters, mutations, actions, plugins: [createLogger()]
|
|
}) as Store;
|
|
|
|
/**
|
|
* Use the store
|
|
*/
|
|
export function useStore() {
|
|
return store;
|
|
}
|
|
|
|
/**
|
|
* Export the store instance by default
|
|
*/
|
|
export default store;
|