Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Vue from "vue";
- import Vuex from "vuex";
- import * as types from "./types";
- Vue.use(Vuex);
- export default new Vuex.Store({
- state: {
- //STORE_STATE_NODE
- animation: false,
- animation0: false,
- animation1: false,
- animation2: false,
- is_won: false,
- disableButtons: false,
- bet: 0,
- currentWin: 0,
- balance: 100000,
- getButtonsValue: 0,
- },
- mutations: {
- [types.COUNT_ANIMATION_DURATION]: (state, payload) => {
- state.animation0 = payload.first;
- state.animation1 = payload.second;
- state.animation2 = payload.third;
- },
- [types.START_ANIMATION]: (state, payload) => {
- state.animation = payload;
- },
- [types.DISABLE_BUTTONS]: (state, payload) => {
- state.disableButtons = payload;
- },
- [types.GET_BET]: (state, payload) => {
- state.bet = payload;
- },
- [types.CURRENT_WIN]: (state, payload) => {
- if (payload === 0) return (state.currentWin = 0), (state.bet = 0);
- state.currentWin = payload;
- },
- //MUTATIONS_NODE_STORE
- [types.IS_WON]: (state, val) => {
- state.is_won = val;
- },
- [types.BALANCE]: (state, val) => {
- state.balance = val;
- },
- [types.GET_BUTTONS_VALUE]: (state, val) => {
- state.getButtonsValue = val;
- },
- },
- actions: {
- [types.ACTION_COUNT_ANIMATION_DURATION]({ commit }, payload) {
- commit(types.COUNT_ANIMATION_DURATION, payload);
- },
- [types.ACTION_START_ANIMATION]({ commit }, payload) {
- commit(types.START_ANIMATION, payload);
- },
- [types.ACTION_GET_BET]({ commit }, payload) {
- commit(types.GET_BET, payload);
- },
- [types.ACTION_DISABLE_BUTTONS]({ commit }, payload) {
- commit(types.DISABLE_BUTTONS, payload);
- },
- [types.ACTION_CURRENT_WIN]({ commit }, payload) {
- commit(types.CURRENT_WIN, payload);
- },
- //ACTIONS_NODE_STORE
- [types.ACTION_IS_WON]({ commit }, val) {
- commit(types.IS_WON, val);
- },
- [types.ACTION_BALANCE]({ commit }, val) {
- commit(types.BALANCE, val);
- },
- [types.ACTION_GET_BUTTONS_VALUE]({ commit }, val) {
- commit(types.GET_BUTTONS_VALUE, val);
- },
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement