changes of giftCard page
This commit is contained in:
+30
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user