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

Vue.use(Vuex)


export default new Vuex.Store({
    state: {
        isLoading: false,
        direction: 'forward',
        userInfo: {},
        locationInfo: null,
        customerPhone: '400886886',
        baseUrl: '',
        fetchingData: false,
        orderStatus: ['待客服确认', '带看房', '已完成', '已取消'],
        redirect: null
    },
    mutations: {
        updateRedirect(state, redirect) {
            state.redirect = redirect
        },
        updateLoading(state, status) {
            state.isLoading = status
        },
        updateDirection(state, direction) {
            state.direction = direction
        },
        updateFetchingData(state, fetchingData) {
            state.fetchingData = fetchingData
        },
        updateLocationInfo(state, location) {
            state.locationInfo = location
        },
        updateUserInfo(state, value) {
            state.userInfo = value
        },
        updateBaseUrl(state, value) {
            state.baseUrl = value
        }
    }
})