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

Vue.use(Vuex);

export default new Vuex.Store({
    state: {
        tableHeight: 0,
        allHeight: 0,
        fetchingData: false,
        userInfo: null,
        farmName: '金华',
        loginHistory: [{
            name: '/dashboard',
            title: '首页'
        }],
        chooseLogin: 'dashboard',
        windowSize: {
            width: 0,
            height: 0
        }
    },
    mutations: {
        updateTableHeight(state, height) {
            state.tableHeight = height;
        },
        updateAllHeight(state, height) {
            state.allHeight = height;
        },
        updateFetchingData(state, fetchingData) {
            state.fetchingData = fetchingData
        },
        updateUserInfo(state, userInfo) {
            state.userInfo = userInfo
        },
        updateLoginHistory(state, list) {
            state.loginHistory = list
        },
        updateChooseLogin(state, name) {
            state.chooseLogin = name
        },
        updateWindowSize(state, windowSize) {
            state.windowSize = windowSize
        }
    },
    actions: {}
});