89 lines
2.4 KiB
TypeScript
89 lines
2.4 KiB
TypeScript
import {
|
|
createRouter,
|
|
createWebHistory,
|
|
RouteLocationNormalized,
|
|
} from "vue-router";
|
|
import Account from "../pages/Account.vue";
|
|
import AllAccounts from "../pages/AllAccounts.vue";
|
|
import Budgeting from "../pages/Budgeting.vue";
|
|
import BudgetSidebar from "../pages/BudgetSidebar.vue";
|
|
import Dashboard from "../pages/Dashboard.vue";
|
|
import Login from "../pages/Login.vue";
|
|
import Register from "../pages/Register.vue";
|
|
import Settings from "../pages/Settings.vue";
|
|
import WelcomePage from "../pages/WelcomePage.vue";
|
|
|
|
const routes = [
|
|
{
|
|
path: "/",
|
|
name: "Index",
|
|
component: WelcomePage,
|
|
meta: { hideForAuth: true },
|
|
},
|
|
{
|
|
path: "/dashboard",
|
|
name: "Dashboard",
|
|
component: Dashboard,
|
|
meta: { requiresAuth: true },
|
|
},
|
|
{
|
|
path: "/login",
|
|
name: "Login",
|
|
component: Login,
|
|
meta: { hideForAuth: true },
|
|
},
|
|
{
|
|
path: "/register",
|
|
name: "Register",
|
|
component: Register,
|
|
meta: { hideForAuth: true },
|
|
},
|
|
{
|
|
path: "/budget/:budgetid/budgeting",
|
|
name: "Budget",
|
|
redirect: (to: RouteLocationNormalized) =>
|
|
"/budget/" +
|
|
to.params.budgetid +
|
|
"/budgeting/" +
|
|
new Date().getFullYear() +
|
|
"/" +
|
|
new Date().getMonth(),
|
|
meta: { requiresAuth: true },
|
|
},
|
|
{
|
|
path: "/budget/:budgetid/budgeting/:year/:month",
|
|
name: "Budget with date",
|
|
components: { default: Budgeting, sidebar: BudgetSidebar },
|
|
props: true,
|
|
meta: { requiresAuth: true },
|
|
},
|
|
{
|
|
path: "/budget/:budgetid/Settings",
|
|
name: "Budget Settings",
|
|
components: { default: Settings, sidebar: BudgetSidebar },
|
|
props: true,
|
|
meta: { requiresAuth: true },
|
|
},
|
|
{
|
|
path: "/budget/:budgetid/problematic-transactions",
|
|
name: "Problematic Transactions",
|
|
components: { default: AllAccounts, sidebar: BudgetSidebar },
|
|
props: true,
|
|
meta: { requiresAuth: true },
|
|
},
|
|
{
|
|
path: "/budget/:budgetid/account/:accountid",
|
|
name: "Account",
|
|
components: { default: Account, sidebar: BudgetSidebar },
|
|
props: true,
|
|
meta: { requiresAuth: true },
|
|
},
|
|
];
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes,
|
|
});
|
|
|
|
export default router;
|