Skip to content

Commit

Permalink
fix(sidebar): also allow vice presidents to view restricted pages
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerzl committed Oct 1, 2024
1 parent 6bb328c commit 5476764
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/custom/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { AllClubs } from '~/types/api/user/all_clubs'
const route = useRoute()
const isPresident = ref(false)
const isPresidentOrVicePresident = ref(false)
const { data } = await useAsyncData<AllClubs>('classroomStatuses', () => {
return $fetch<AllClubs>(`/api/user/all_clubs`, {
Expand All @@ -14,8 +14,8 @@ const { data } = await useAsyncData<AllClubs>('classroomStatuses', () => {
})
})
if (data.value?.president.length !== 0) {
isPresident.value = true
if (data.value?.president.length !== 0 || data.value?.vice.length !== 0) {
isPresidentOrVicePresident.value = true
}
</script>

Expand Down Expand Up @@ -69,14 +69,14 @@ if (data.value?.president.length !== 0) {
CAS管理
</h2>
<div class="mt-2">
<NuxtLink v-if="isPresident" to="/manage/reservation">
<NuxtLink v-if="isPresidentOrVicePresident" to="/manage/reservation">
<Button :variant="route.name === 'manage-reservation' ? 'secondary' : 'ghost'" class="w-full justify-start">
<Icon class="mr-2 h-4 w-4" name="material-symbols:calendar-today-outline" />
预约教室
</Button>
</NuxtLink>
<NuxtLink to="/manage/manage">
<Button v-if="isPresident" :variant="route.name === 'manage-manage' ? 'secondary' : 'ghost'" class="w-full justify-start">
<Button v-if="isPresidentOrVicePresident" :variant="route.name === 'manage-manage' ? 'secondary' : 'ghost'" class="w-full justify-start">
<Icon class="mr-2 h-4 w-4" name="material-symbols:calendar-today-outline" />
管理预约
</Button>
Expand All @@ -88,7 +88,7 @@ if (data.value?.president.length !== 0) {
</Button>
</NuxtLink>
<NuxtLink to="/manage/record">
<Button v-if="isPresident" :variant="route.name === 'manage-record' ? 'secondary' : 'ghost'" class="w-full justify-start mt-1">
<Button v-if="isPresidentOrVicePresident" :variant="route.name === 'manage-record' ? 'secondary' : 'ghost'" class="w-full justify-start mt-1">
<Icon class="mr-2 h-4 w-4" name="charm:tick-double" />
活动记录
</Button>
Expand Down

0 comments on commit 5476764

Please sign in to comment.