fix(analytics): add to and from dates to campaign analytics URL (#1952)

Co-authored-by: Adrian Moya <adrian@csma.tehcnology>
This commit is contained in:
Adrian Moya 2024-07-25 08:30:04 -04:00 committed by GitHub
parent 23d236fec0
commit 45f1f80a76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -247,7 +247,7 @@ export default Vue.extend({
},
onSubmit() {
this.$router.push({ query: { id: this.form.campaigns.map((c) => c.id) } });
this.$router.push({ query: { id: this.form.campaigns.map((c) => c.id), from: dayjs(this.form.from).unix(), to: dayjs(this.form.to).unix() } });
},
queryCampaigns(q) {
@ -300,8 +300,11 @@ export default Vue.extend({
created() {
const now = dayjs().set('hour', 23).set('minute', 59).set('seconds', 0);
this.form.to = now.toDate();
this.form.from = now.subtract(7, 'day').set('hour', 0).set('minute', 0).toDate();
const weekAgo = now.subtract(7, 'day').set('hour', 0).set('minute', 0);
const from = this.$route.query.from ? dayjs.unix(this.$route.query.from) : weekAgo;
const to = this.$route.query.to ? dayjs.unix(this.$route.query.to) : now;
this.form.from = from.toDate();
this.form.to = to.toDate();
},
mounted() {