import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
    state: {
        tableHeight: 0,
        fetchingData: false,
        userInfo: null,
        projectId: parseInt(localStorage.getItem('9th_projectId') || 0)
    },
    mutations: {
        updateTableHeight(state, height) {
            state.tableHeight = height;
        },
        updateFetchingData(state, fetchingData) {
            state.fetchingData = fetchingData;
        },
        updateUserInfo(state, userInfo) {
            state.userInfo = userInfo;
        },
        setProjectId(state, projectId) {
            state.projectId = projectId;
            localStorage.setItem('9th_projectId', projectId);
        }
    },
    actions: {}
});
