47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { storeActions } from "@/constants/store-actions.js";
|
|
import { storeMutations } from "@/constants/store-mutations.js";
|
|
import { widgetNames } from "@/constants/widget-names.js";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
};
|
|
},
|
|
methods: {
|
|
// dispatchBlockingStoreAction(type, payload) {
|
|
// // globalMethods.showWaitingModal(true);
|
|
|
|
// return this.dispatchNonBlockingStoreAction(type, payload).finally(() => {
|
|
// // globalMethods.showWaitingModal(false);
|
|
// });
|
|
// },
|
|
dispatchNonBlockingStoreAction(type, payload, encodePayload = false) {
|
|
// Encode the payload if required
|
|
if (encodePayload) {
|
|
encodeUriData(payload);
|
|
}
|
|
|
|
return this.$store.dispatch(type, payload);
|
|
},
|
|
},
|
|
computed: {
|
|
storeActions() {
|
|
return storeActions;
|
|
},
|
|
storeMutations() {
|
|
return storeMutations;
|
|
},
|
|
widgetNames() {
|
|
return widgetNames;
|
|
},
|
|
},
|
|
};
|
|
|
|
function encodeUriData(payload) {
|
|
if (payload && Object.keys(payload).length > 0) {
|
|
// Loop through the payload and encode the values
|
|
Object.keys(payload).forEach((key) => {
|
|
payload[key] = encodeURIComponent(payload[key]);
|
|
});
|
|
}
|
|
}
|