Redirect to current route from site without date

This commit is contained in:
2022-02-08 11:13:55 +00:00
parent d2b414f328
commit eb195dfd29
2 changed files with 27 additions and 21 deletions

View File

@ -1,5 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router'
import DashboardCard from '../components/Card.vue';
import { createRouter, createWebHistory, RouteLocationNormalized } from 'vue-router'
import Dashboard from '../pages/Dashboard.vue';
import Login from '../pages/Login.vue';
import Index from '../pages/Index.vue';
@ -14,7 +13,9 @@ const routes = [
{ path: "/dashboard", name: "Dashboard", component: Dashboard },
{ path: "/login", name: "Login", component: Login },
{ path: "/register", name: "Register", component: Register },
{ path: "/budget/:budgetid", name: "Budget", components: { default: Budgeting, sidebar: BudgetSidebar }, props: true },
{ path: "/budget/:budgetid", name: "Budget", redirect: (to : RouteLocationNormalized) =>
'/budget/' + to.params.budgetid + '/' + new Date().getFullYear() + '/' + new Date().getMonth()
},
{ path: "/budget/:budgetid/:year/:month", name: "Budget with date", components: { default: Budgeting, sidebar: BudgetSidebar }, props: true },
{ path: "/budget/:budgetid/Settings", name: "Budget Settings", components: { default: Settings, sidebar: BudgetSidebar }, props: true },
{ path: "/budget/:budgetid/account/:accountid", name: "Account", components: { default: Account, sidebar: BudgetSidebar }, props: true },