import system from "@/core/models/system";
export default {
    namespaced: true,
    state: {
        currentCateId: 0,
        currentOrderTabIndex: 0,
        platformData: {
            loaded: false,
            about: "",
            privacy: "",
            service: "",
            serviceMobile: "",
        },
        refreshOrder: true,
    },
    getters: {},
    mutations: {
        currentCateId(state, data) {
            state.currentCateId = data;
        },
        currentOrderTabIndex(state, data) {
            state.currentOrderTabIndex = data;
        },
        platformData(state, data) {
            state.platformData = data;
        },
        refreshOrder(state, data) {
            state.refreshOrder = data;
        }
    },
    actions: {
        async platformData(context, data) {
            if (context.state.platformData.loaded) return;
            await system.platformData().then(data => {
                context.commit('platformData', {
                    ...data,
                    loaded: true,
                });
            });
        }
    }
}
