add network
This commit is contained in:
@@ -7,6 +7,7 @@ import DashboardView from "@/components/dashboard/DashboardView.vue";
|
||||
import RecurrentyCreateUpdate from "@/components/settings/RecurrentyCreateUpdate.vue";
|
||||
import TransactionList from "@/components/transactions/TransactionList.vue";
|
||||
import LoginPage from "@/components/auth/LoginPage.vue";
|
||||
import TransactionCreateUpdate from "@/components/transactions/TransactionCreateUpdate.vue";
|
||||
|
||||
// 📝 Расширяем тип меты роутов (типобезопасный toolbar, requiresAuth, guestOnly)
|
||||
declare module 'vue-router' {
|
||||
@@ -29,6 +30,8 @@ export const enum RouteName {
|
||||
Login = 'login',
|
||||
Dashboard = 'dashboard',
|
||||
TransactionList = 'transaction-list',
|
||||
TransactionCreate = 'transaction-create',
|
||||
TransactionUpdate = 'transaction-update',
|
||||
SettingsList = 'settings-list',
|
||||
CategoriesList = 'categories-list',
|
||||
CategoryCreate = 'category-create',
|
||||
@@ -42,53 +45,82 @@ export const enum RouteName {
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{path: '/login', name: RouteName.Login, component: LoginPage, meta: {requiresAuth: false, navStack: 'auth'}},
|
||||
{path: '/', name: RouteName.Dashboard, component: DashboardView, meta: {requiresAuth: true, navStack: 'dashboard'}},
|
||||
{path: '/transactions', name: RouteName.TransactionList, component: TransactionList, meta: {requiresAuth: true, navStack: 'transactions'}},
|
||||
{path: '/settings', name: RouteName.SettingsList, component: SettingsList, meta: {requiresAuth: true, navStack: 'settings'}},
|
||||
{path: '/', name: RouteName.Dashboard, component: DashboardView, meta: {requiresAuth: true, navStack: 'dashboard', title: "Home"}},
|
||||
{
|
||||
path: '/transactions',
|
||||
name: RouteName.TransactionList,
|
||||
component: TransactionList,
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
|
||||
{id: 'openTransactionCreation', text: '', icon: 'pi pi-plus', onClickId: 'openTransactionCreation'},
|
||||
],
|
||||
navStack: 'transactions',
|
||||
title: "Transactions"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/transactions/create', name: RouteName.TransactionCreate, component: TransactionCreateUpdate, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{id: 'createTransaction', text: '', icon: 'pi pi-save', onClickId: 'createTransaction'},
|
||||
],
|
||||
navStack: 'transactions',
|
||||
title: "Create transaction"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/transactions/:id/edit', name: RouteName.TransactionUpdate, component: TransactionCreateUpdate, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
|
||||
{id: 'deleteTransaction', text: '', icon: 'pi pi-trash', onClickId: 'deleteTransaction'},
|
||||
{id: 'updateTransaction', text: '', icon: 'pi pi-save', onClickId: 'updateTransaction'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Edit transaction"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/settings',
|
||||
name: RouteName.SettingsList,
|
||||
component: SettingsList,
|
||||
meta: {requiresAuth: true, navStack: 'settings', title: "Settings"}
|
||||
},
|
||||
{
|
||||
path: '/categories', name: RouteName.CategoriesList, component: CategoriesList, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{
|
||||
id: 'space',
|
||||
text: spaceStore.selectedSpaceName ?? 'Select Space',
|
||||
icon: '',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
|
||||
{id: 'openCategoryCreation', text: '', icon: 'pi pi-plus', onClickId: 'openCategoryCreation'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Categories"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/categories/create', name: RouteName.CategoryCreate, component: CategoryCreateUpdate, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{
|
||||
id: 'space',
|
||||
text: spaceStore.selectedSpaceName ?? 'Select Space',
|
||||
icon: '',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
|
||||
{id: 'createCategory', text: '', icon: 'pi pi-save', onClickId: 'createCategory'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Create category"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/categories/:id/edit', name: RouteName.CategoryUpdate, component: CategoryCreateUpdate, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{
|
||||
id: 'space',
|
||||
text: spaceStore.selectedSpaceName ?? 'Select Space',
|
||||
icon: '',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
|
||||
{id: 'deleteCategory', text: '', icon: 'pi pi-trash', onClickId: 'deleteCategory'},
|
||||
{id: 'updateCategory', text: '', icon: 'pi pi-save', onClickId: 'updateCategory'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Edit category"
|
||||
}
|
||||
|
||||
},
|
||||
@@ -97,46 +129,34 @@ const routes: RouteRecordRaw[] = [
|
||||
path: '/recurrents', name: RouteName.RecurrentsList, component: RecurrentsList, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{
|
||||
id: 'space',
|
||||
text: spaceStore.selectedSpaceName ?? 'Select Space',
|
||||
icon: 'pi pi-home',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
|
||||
{id: 'openRecurrentCreation', text: '', icon: 'pi pi-plus', onClickId: 'openRecurrentCreation'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Recurrents"
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/recurrents/create', name: RouteName.RecurrentCreate, component: RecurrentyCreateUpdate, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{
|
||||
id: 'space',
|
||||
text: spaceStore.selectedSpaceName ?? 'Select Space',
|
||||
icon: '',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
|
||||
{id: 'createRecurrent', text: '', icon: 'pi pi-save', onClickId: 'createRecurrent'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Create recurrent"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/recurrents/:id/edit', name: RouteName.RecurrentUpdate, component: RecurrentyCreateUpdate, meta: {
|
||||
requiresAuth: true,
|
||||
toolbar: ({spaceStore}: { spaceStore: ReturnType<typeof useSpaceStore> }) => [
|
||||
{
|
||||
id: 'space',
|
||||
text: spaceStore.selectedSpaceName ?? 'Select Space',
|
||||
icon: '',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
|
||||
{id: 'deleteRecurrent', text: '', icon: 'pi pi-trash', onClickId: 'deleteRecurrent'},
|
||||
{id: 'updateRecurrent', text: '', icon: 'pi pi-save', onClickId: 'updateRecurrent'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Edit recurrent"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -152,17 +172,20 @@ const routes: RouteRecordRaw[] = [
|
||||
icon: 'pi pi-home',
|
||||
onClickId: 'openSpacePicker',
|
||||
},
|
||||
{id: 'save', text: 'Save', icon: 'pi pi-check', onClickId: 'saveSettings'},
|
||||
// {id: 'save', text: 'Save', icon: 'pi pi-check', onClickId: 'saveSettings'},
|
||||
],
|
||||
navStack: 'settings',
|
||||
title: "Space settings"
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/notification-settings',
|
||||
name: RouteName.NotificationSettings,
|
||||
component: NotificationSettings,
|
||||
meta: {requiresAuth: true,
|
||||
navStack: 'settings',}
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
navStack: 'settings',
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
@@ -204,6 +227,12 @@ router.afterEach((to) => {
|
||||
} else {
|
||||
toolbar.setByConfig(cfg)
|
||||
}
|
||||
|
||||
if (to.meta.title) {
|
||||
document.title = `${to.meta.title as string} | Luminic Space`
|
||||
} else {
|
||||
document.title = "Luminic Space"
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user