You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

110 lines
2.9 KiB

// state
export const state = () => ({
pictureUpdate: false,
drawerIsActive: false,
searchDialogIsActive: false,
socialRegisterUpdate: false,
currency: "NTD",
hidePrice:false,
OrgID: 'TE',
});
// actions
export const actions = {
updatePicture({ commit }) {
commit("changePicture");
},
updateRegister({ commit }) {
commit("changeRegisterState");
},
toggleDrawer({ commit }, value) {
commit("toggleDrawerState",value);
},
toggleSearchDialog({ commit },value) {
commit("toggleSearchDialogState",value);
},
updateCurrency({ commit }, value) {
commit("updateCurrencyValue", (value = value));
},
hideSwitchPrice({ commit }, value) {
commit("hideSwitchPriceValue", value);
},
toggleOrgID({ commit }) {
return new Promise((resolve, reject) => {
this.$axios
.get(`/trending/api/index/GetOrgID`)
.then((response) => {
if(response && response.data && response.data.DATA && response.data.DATA.rel){
let data = response.data.DATA.rel
if(data){
commit("toggleOrgIDValue",data);
}
}
resolve();
})
.catch((error) =>
reject(error)
);
})
},
};
// mutations
export const mutations = {
changePicture(state) {
state.pictureUpdate = !state.pictureUpdate;
// this.$cookies.set("pictureUpdate",JSON.stringify(state.pictureUpdate));
},
changeRegisterState(state) {
state.socialRegisterUpdate = !state.socialRegisterUpdate;
// this.$cookies.set("socialRegisterUpdate",JSON.stringify(state.socialRegisterUpdate));
},
toggleDrawerState(state, payload) {
state.drawerIsActive = payload;
// this.$cookies.set("drawerIsActive",JSON.stringify(state.drawerIsActive));
},
toggleSearchDialogState(state,payload) {
state.searchDialogIsActive = payload;
// this.$cookies.set("searchDialogIsActive",JSON.stringify(state.searchDialogIsActive));
},
updateCurrencyValue(state, value) {
state.currency = value;
// this.$cookies.set("currency",JSON.stringify(state.currency));
},
hideSwitchPriceValue(state,payload) {
state.hidePrice = payload
// this.$cookies.set("hidePrice",JSON.stringify(state.hidePrice));
},
toggleOrgIDValue(state, value) {
state.OrgID = value;
// this.$cookies.set("OrgID",JSON.stringify(state.OrgID));
},
};
// getters
export const getters = {
getPictureStatus(state) {
// if(this.$cookies.get("pictureUpdate")!=undefined){
// state.pictureUpdate = JSON.parse(this.$cookies.get("pictureUpdate"));
// }
return state.pictureUpdate;
},
getRegisterStatus(state) {
return state.socialRegisterUpdate;
},
getDrawerStatus(state) {
return state.drawerIsActive;
},
getSearchDialogStatus(state) {
return state.searchDialogIsActive;
},
getCurrency(state) {
return state.currency;
},
getHidePrice(state) {
return state.hidePrice;
},
getOrgID(state) {
return state.OrgID;
},
};