Compare commits
2 Commits
612a6e3dfe
...
e4a0eb463b
| Author | SHA1 | Date | |
|---|---|---|---|
| e4a0eb463b | |||
| 20551fee63 |
@@ -7,7 +7,9 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-block__logo">
|
<div class="header-block__logo">
|
||||||
|
<a :href="MAIN_SITE_URL">
|
||||||
<img :src="logo" alt="logo" />
|
<img :src="logo" alt="logo" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-block__title">
|
<div class="header-block__title">
|
||||||
<slot>
|
<slot>
|
||||||
@@ -52,6 +54,7 @@
|
|||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useUIStore } from '@/store/ui'
|
import { useUIStore } from '@/store/ui'
|
||||||
|
import { MAIN_SITE_URL } from '@/enums'
|
||||||
import { gallery } from '@/utils/gallery'
|
import { gallery } from '@/utils/gallery'
|
||||||
import useAuth from '@/composables/useAuth'
|
import useAuth from '@/composables/useAuth'
|
||||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||||
@@ -149,7 +152,12 @@ const iconList = [
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
display: block;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: 3.5rem;
|
height: 3.5rem;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
|||||||
+4
-1
@@ -220,8 +220,11 @@ export const MISSIONARY_REQUEST_STATUS = Object.freeze({
|
|||||||
rejected: 'رد شده',
|
rejected: 'رد شده',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const MAIN_SITE_URL = 'https://madresebanoo.ir/'
|
||||||
|
|
||||||
// Landing route per role after login / when a logged-in user hits a guest
|
// Landing route per role after login / when a logged-in user hits a guest
|
||||||
// page. Roles not listed here fall back to the student dashboard.
|
// page. Roles not listed here fall back to the student dashboard. Approved
|
||||||
|
// users of every role except admin bypass this and land on MAIN_SITE_URL.
|
||||||
export const ROLE_HOME_ROUTES = Object.freeze({
|
export const ROLE_HOME_ROUTES = Object.freeze({
|
||||||
admin: 'admin-dashboard',
|
admin: 'admin-dashboard',
|
||||||
counselor: 'counselor-dashboard',
|
counselor: 'counselor-dashboard',
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { ROLE_HOME_ROUTES } from '@/enums'
|
|
||||||
import { useAuthStore } from '@/store/auth'
|
import { useAuthStore } from '@/store/auth'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
import { MAIN_SITE_URL, ROLE_HOME_ROUTES } from '@/enums'
|
||||||
|
|
||||||
|
export const shouldLandOnMainSite = (auth) =>
|
||||||
|
auth.role !== 'admin' && auth.user?.status === 'approved'
|
||||||
|
|
||||||
export const useRedirectAfterLogin = () => {
|
export const useRedirectAfterLogin = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -13,6 +16,10 @@ export const useRedirectAfterLogin = () => {
|
|||||||
router.push(redirect).catch(() => router.push('/'))
|
router.push(redirect).catch(() => router.push('/'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (shouldLandOnMainSite(auth)) {
|
||||||
|
window.location.href = MAIN_SITE_URL
|
||||||
|
return
|
||||||
|
}
|
||||||
const target = { name: ROLE_HOME_ROUTES[auth.role] || 'student-dashboard' }
|
const target = { name: ROLE_HOME_ROUTES[auth.role] || 'student-dashboard' }
|
||||||
router.push(target).catch(() => router.push('/'))
|
router.push(target).catch(() => router.push('/'))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<aside class="admin-sidebar">
|
<aside class="admin-sidebar">
|
||||||
<div class="admin-sidebar__logo">
|
<div class="admin-sidebar__logo">
|
||||||
|
<a :href="MAIN_SITE_URL">
|
||||||
<img :src="logo" alt="مدرسه بانو" />
|
<img :src="logo" alt="مدرسه بانو" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<nav class="admin-sidebar__nav">
|
<nav class="admin-sidebar__nav">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -56,6 +58,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { RouterLink } from 'vue-router'
|
import { RouterLink } from 'vue-router'
|
||||||
|
import { MAIN_SITE_URL } from '@/enums'
|
||||||
import { gallery } from '@/utils/gallery'
|
import { gallery } from '@/utils/gallery'
|
||||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||||
import SidebarLogout from '@/layouts/sidebars/SidebarLogout.vue'
|
import SidebarLogout from '@/layouts/sidebars/SidebarLogout.vue'
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<aside class="counselor-sidebar">
|
<aside class="counselor-sidebar">
|
||||||
<div class="counselor-sidebar__logo">
|
<div class="counselor-sidebar__logo">
|
||||||
|
<a :href="MAIN_SITE_URL">
|
||||||
<img :src="logo" alt="مدرسه بانو" />
|
<img :src="logo" alt="مدرسه بانو" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<nav class="counselor-sidebar__nav">
|
<nav class="counselor-sidebar__nav">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -23,6 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { MAIN_SITE_URL } from '@/enums'
|
||||||
import { gallery } from '@/utils/gallery'
|
import { gallery } from '@/utils/gallery'
|
||||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||||
import SidebarLogout from '@/layouts/sidebars/SidebarLogout.vue'
|
import SidebarLogout from '@/layouts/sidebars/SidebarLogout.vue'
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<aside class="student-sidebar" :style="{ backgroundImage: `url(${bgPattern})` }">
|
<aside class="student-sidebar" :style="{ backgroundImage: `url(${bgPattern})` }">
|
||||||
<div class="student-sidebar__logo">
|
<div class="student-sidebar__logo">
|
||||||
|
<a :href="MAIN_SITE_URL">
|
||||||
<img :src="logo" alt="مدرسه بانو" />
|
<img :src="logo" alt="مدرسه بانو" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<nav class="student-sidebar__nav">
|
<nav class="student-sidebar__nav">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -23,6 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { MAIN_SITE_URL } from '@/enums'
|
||||||
import { gallery } from '@/utils/gallery'
|
import { gallery } from '@/utils/gallery'
|
||||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||||
import SidebarLogout from '@/layouts/sidebars/SidebarLogout.vue'
|
import SidebarLogout from '@/layouts/sidebars/SidebarLogout.vue'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { ROLE_HOME_ROUTES } from '@/enums'
|
|
||||||
import { useAuthStore } from '@/store/auth'
|
import { useAuthStore } from '@/store/auth'
|
||||||
|
import { MAIN_SITE_URL, ROLE_HOME_ROUTES } from '@/enums'
|
||||||
import { tokenService } from '@/services/api/token-service'
|
import { tokenService } from '@/services/api/token-service'
|
||||||
|
import { shouldLandOnMainSite } from '@/features/auth/composables/useRedirectAfterLogin'
|
||||||
|
|
||||||
const APP_TITLE = 'مدرسه بانو'
|
const APP_TITLE = 'مدرسه بانو'
|
||||||
|
|
||||||
@@ -19,6 +20,10 @@ export const guestGuard = (to) => {
|
|||||||
if (!to.meta?.requiresGuest) return
|
if (!to.meta?.requiresGuest) return
|
||||||
if (tokenService.hasToken()) {
|
if (tokenService.hasToken()) {
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
|
if (shouldLandOnMainSite(auth)) {
|
||||||
|
window.location.href = MAIN_SITE_URL
|
||||||
|
return false
|
||||||
|
}
|
||||||
return { name: ROLE_HOME_ROUTES[auth.role] || 'student-dashboard' }
|
return { name: ROLE_HOME_ROUTES[auth.role] || 'student-dashboard' }
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user