Skip to content

Commit

Permalink
feat: Replace router with query when input date changes
Browse files Browse the repository at this point in the history
Aldemylla committed May 8, 2024
1 parent 4b8c9e5 commit 58fb4da
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/layouts/InsightsLayout/Header.vue
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
class="filters__date-picker"
v-model="filterDate"
size="sm"
inputFormat="DD/MM/YYYY"
/>
</section>
</header>
@@ -100,6 +101,12 @@ export default {
this.selectedDashboard[0] = dashboardRelativeToPath;
},
filterDate(newDate) {
this.$router.replace({
name: this.$route.name,
query: { startDate: newDate.start, endDate: newDate.end },
});
},
},
};
</script>
4 changes: 4 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -22,6 +22,10 @@ const router = createRouter({
path: '/',
name: 'home',
component: Home,
props: (route) => ({
startDate: route.query.startDate,
endDate: route.query.endDate,
}),
},
{
path: '/dashboards',

0 comments on commit 58fb4da

Please sign in to comment.