46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import store from "@/store";
|
|
import { storeActions } from "@/constants/store-actions.js";
|
|
import { storeMutations } from "@/constants/store-mutations.js";
|
|
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
|
import { widgetNames } from "@/constants/widget-names.js";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
routedToLastKnownPage: false,
|
|
};
|
|
},
|
|
methods: {
|
|
dispatchNonBlockingStoreAction(type, payload, encodePayload = true) {
|
|
// Encode the payload if required
|
|
if (encodePayload) {
|
|
encodeUriData(payload);
|
|
}
|
|
|
|
return store.dispatch(type, payload);
|
|
},
|
|
},
|
|
computed: {
|
|
storeActions() {
|
|
return storeActions;
|
|
},
|
|
storeMutations() {
|
|
return storeMutations;
|
|
},
|
|
navigationScenarios() {
|
|
return navigationScenarios;
|
|
},
|
|
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]);
|
|
});
|
|
}
|
|
}
|