init repo
This commit is contained in:
10
store/README.md
Normal file
10
store/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# STORE
|
||||
|
||||
**This directory is not required, you can delete it if you don't want to use it.**
|
||||
|
||||
This directory contains your Vuex Store files.
|
||||
Vuex Store option is implemented in the Nuxt.js framework.
|
||||
|
||||
Creating a file in this directory automatically activates the option in the framework.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
|
||||
24
store/index.js
Normal file
24
store/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
export const state = () => ({
|
||||
gameSettings: {
|
||||
playerCount: 0,
|
||||
turnCount: 0,
|
||||
iterationCount: 0,
|
||||
},
|
||||
gameStarted: false,
|
||||
});
|
||||
|
||||
export const mutations = {
|
||||
SET_GAME_SETTINGS(state, settings) {
|
||||
state.gameSettings = settings;
|
||||
},
|
||||
SET_GAME_STARTED(state, value) {
|
||||
state.gameStarted = value;
|
||||
}
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
initializeGame({ commit }, settings) {
|
||||
commit('SET_GAME_SETTINGS', settings);
|
||||
commit('SET_GAME_STARTED', true);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user