import { Apple } from "@/models/Apple";
export interface ApplesState {
items: Array<Apple>
}
export default {
namespaced: true,
state: (): ApplesState => ({
items: Array<Apple>()
}),
mutations: {
setApples: function(state: ApplesState, apples: Array<Apple>): void {
state.items = apples;
}
}
}
import Vue from 'vue'
import Vuex from 'vuex'
import appleModule, { ApplesState } from './AppleModule'
Vue.use(Vuex)
export interface State {
apples: ApplesState;
}
export default new Vuex.Store<State>({
modules: {
apples: appleModule
}
})