changes of giftCard page

This commit is contained in:
2026-10-20 12:11:46 +03:30
parent 2927d64c64
commit e5b3d0c931
55 changed files with 1495 additions and 140 deletions
+30 -2
View File
@@ -14,6 +14,14 @@ import { setupRoutes } from '@/router'
import { useUserStore } from '@/store/userStore'
import { setupPinia } from '@core/plugins/pinia'
import { initStoreModeFromSettings } from '@/utils/config'
import { message } from 'ant-design-vue'
import {
canOpenRoute,
firstAllowedInBranch,
firstAllowedRouteName,
notifyPageDenied
} from '@/utils/adminPageAccess'
import { setCurrentAdminRoute } from '@/utils/adminAccessState'
const init = async () => {
const app = createApp(App)
@@ -57,9 +65,29 @@ const init = async () => {
const token = getToken()
if (token) {
if (to.name == 'login') {
return next({ name: 'dashboard' })
return next({ name: firstAllowedRouteName() || 'dashboardMain' })
}
return next()
if (canOpenRoute(to.name)) {
setCurrentAdminRoute(String(to.name || ''))
return next()
}
const redirectedFrom = to.redirectedFrom?.name
if (redirectedFrom) {
const branchTarget = firstAllowedInBranch(String(redirectedFrom))
if (branchTarget && branchTarget !== String(to.name)) {
return next({ name: branchTarget })
}
}
if (from.name && String(from.name) !== 'login') {
notifyPageDenied()
return next(false)
}
const first = firstAllowedRouteName()
if (first && first !== String(to.name)) {
return next({ name: first })
}
message.warning({ content: 'شما به این صفحه دسترسی ندارید', key: 'admin-page-denied' })
return next(false)
} else {
if (['login', '404'].includes(to.name as string)) {
return next()