mirror of
https://github.com/r-ca/kidshift-web.git
synced 2024-10-25 16:34:01 +00:00
test
This commit is contained in:
parent
e2250443a8
commit
4b91ab3024
|
@ -1,7 +1,8 @@
|
|||
import { GetterTree } from 'vuex';
|
||||
import { RootStateInterface } from '../index';
|
||||
import { AccountStateInterface } from './state';
|
||||
|
||||
const getters: GetterTree<AccountStateInterface, any> = {
|
||||
const getters: GetterTree<AccountStateInterface, RootStateInterface> = {
|
||||
getToken(state: AccountStateInterface): string {
|
||||
return state.token;
|
||||
},
|
||||
|
|
|
@ -1,59 +1,22 @@
|
|||
import { store } from 'quasar/wrappers';
|
||||
import {
|
||||
createStore,
|
||||
Module,
|
||||
createComposable,
|
||||
Getters,
|
||||
Mutations,
|
||||
} from 'vuex-smart-module';
|
||||
import { createStore } from 'vuex'
|
||||
import accountStateModule from './account';
|
||||
import { AccountStateInterface } from './account/state';
|
||||
|
||||
class RootState {
|
||||
count = 1;
|
||||
}
|
||||
|
||||
class RootGetters extends Getters<RootState> {
|
||||
get count () {
|
||||
return this.state.count;
|
||||
}
|
||||
|
||||
multiply (multiplier: number) {
|
||||
return this.state.count * multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
class RootMutations extends Mutations<RootState> {
|
||||
add (payload: number) {
|
||||
this.state.count += payload;
|
||||
}
|
||||
}
|
||||
|
||||
// This is the config of the root module
|
||||
// You can define a root state/getters/mutations/actions here
|
||||
// Or do everything in separate modules
|
||||
const rootConfig = {
|
||||
state: RootState,
|
||||
getters: RootGetters,
|
||||
mutations: RootMutations,
|
||||
modules: {
|
||||
//
|
||||
},
|
||||
};
|
||||
|
||||
export const root = new Module(rootConfig);
|
||||
|
||||
export default store(function (/* { ssrContext } */) {
|
||||
const rootStore = createStore(root, {
|
||||
strict: !!process.env.DEBUGGING,
|
||||
// plugins: []
|
||||
// and other options, normally passed to Vuex `createStore`
|
||||
});
|
||||
|
||||
return rootStore;
|
||||
});
|
||||
|
||||
export const useStore = createComposable(root);
|
||||
|
||||
export interface RootStateInterface {
|
||||
// Define your own store structure, using submodules if needed
|
||||
account: AccountStateInterface;
|
||||
}
|
||||
|
||||
export default function (/* { ssrContext } */) {
|
||||
const Store = createStore({
|
||||
modules: {
|
||||
accountStateModule
|
||||
},
|
||||
|
||||
// enable strict mode (adds overhead!)
|
||||
// for dev mode and --debug builds only
|
||||
strict: process.env.DEBUGGING === 'true'
|
||||
})
|
||||
|
||||
return Store
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user