I have created an object
var params = {
kpiType: "numeric",
fetchDataFor: "line",
dataFilter: [
{
kpiGroupId: "5a41fd655bca800604b146cc",
kpiId: "",
elementId: "Adult",
label: "HOURLY",
color: "#7F186E",
showOnAxis: "y1",
mapped: [
{
mappedFullSite: 1,
siteId: "full"
}
]
}
],
from: "",
to: "",
timeFrame: "daily",
consolidateSiteData: 1,
consolidateData: 1,
localTimezone: "+04:00"
};
My goal is , I need to reuse this object with different dates and kpiId.
Right now, I have multiple dates selected for multiple KPI's.
For example: for the 1st method the param date is from "2019-08-08 00:00:00" to "2019-08-15 23:59:00" and for the 2nd method date is from "2019-08-01 00:00:00" to "2019-08-07 23:59:00"
And the output for both param shows the last updated date ie "2019-08-01 00:00:00" and "2019-08-07 23:59:00"
//1st Method
getFootfallSelectedPeriod() {
var payload = [];
params.dataFilter[0].kpiId = "5a41fd655bca80kpi14b147cc";
params.from = "2019-08-08 00:00:00";
params.to = "2019-08-15 23:59:00";
// console.log(params);
payload["params"] = params;
payload["mutationId"] = "footfallDataSelected";
console.log(payload);
this.$store.dispatch("getKpiData", payload);
},
// 2nd Method
getFootfallPriorPeriod() {
var payload = [];
params.dataFilter[0].kpiId = "5a41fd655bca80kpi14b147cc";
params.from = "2019-08-01 00:00:00";
params.to = "2019-08-07 23:59:00";
// console.log(params);
payload["params"] = params;
payload["mutationId"] = "footfallDataPriorPeriod";
console.log(payload);
this.$store.dispatch("getKpiData", payload);
}
Currently, When I am calling this object from the method class, it shows the last updated dates and kpiId