check whether user is logined when entering every page

This commit is contained in:
MaysWind
2023-07-23 01:33:42 +08:00
parent 5d7e685dc4
commit af00032ee9
+18 -8
View File
@@ -76,35 +76,43 @@ const router = createRouter({
children: [ children: [
{ {
path: '', path: '',
component: HomePage component: HomePage,
beforeEnter: checkLogin
}, },
{ {
path: '/transactions', path: '/transactions',
component: TransactionsPage component: TransactionsPage,
beforeEnter: checkLogin
}, },
{ {
path: '/statistics/transaction', path: '/statistics/transaction',
component: StatisticsTransactionPage component: StatisticsTransactionPage,
beforeEnter: checkLogin
}, },
{ {
path: '/accounts', path: '/accounts',
component: AccountsPage component: AccountsPage,
beforeEnter: checkLogin
}, },
{ {
path: '/categories', path: '/categories',
component: TransactionCategoriesPage component: TransactionCategoriesPage,
beforeEnter: checkLogin
}, },
{ {
path: '/tags', path: '/tags',
component: TransactionTagsPage component: TransactionTagsPage,
beforeEnter: checkLogin
}, },
{ {
path: '/exchange_rates', path: '/exchange_rates',
component: ExchangeRatesPage component: ExchangeRatesPage,
beforeEnter: checkLogin
}, },
{ {
path: '/user/settings', path: '/user/settings',
component: UserSettingsPage, component: UserSettingsPage,
beforeEnter: checkLogin,
props: route => ({ props: route => ({
tab: route.query.tab tab: route.query.tab
}) })
@@ -112,13 +120,15 @@ const router = createRouter({
{ {
path: '/app/settings', path: '/app/settings',
component: AppSettingsPage, component: AppSettingsPage,
beforeEnter: checkLogin,
props: route => ({ props: route => ({
tab: route.query.tab tab: route.query.tab
}) })
}, },
{ {
path: '/about', path: '/about',
component: AboutPage component: AboutPage,
beforeEnter: checkLogin
} }
] ]
}, },