Skip to content

Commit 1b405c3

Browse files
AyakorKMaghwyn
authored andcommitted
Add new function to check if user is pedagogue to hide calls button
1 parent d783390 commit 1b405c3

2 files changed

Lines changed: 32 additions & 9 deletions

File tree

back-end/src/base/calls/calls.controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,11 @@ export class CallsController {
129129
async isProductOwner(@Jwt() userId: ObjectId, @Res() res: Response) {
130130
return res.status(201).json({ isProductOwner: true });
131131
}
132+
133+
@Get('/is_pedagogue')
134+
@UseGuards(JwtAuthGuard, new RoleValidator(Roles.PEDAGOGUE))
135+
async IsPedagogue(@Jwt() userId: ObjectId, @Res() res: Response) {
136+
console.log(Roles.PEDAGOGUE);
137+
return res.status(201).json({ isPedagogue: true });
138+
}
132139
}

front-end/src/layout/app/DrawerLayout.vue

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@
6363
}"
6464
/>
6565
</DrawerRouterOption>
66-
<DrawerRouterOption to="/app/rollcall" name="Attendance" :fold="!active">
67-
<SvgQrCode
68-
:class="{
69-
'fill-selected-icon dark:fill-selected-icon':
70-
route.path.startsWith('/app/rollcall'),
71-
}"
72-
/>
73-
</DrawerRouterOption>
66+
<div v-if="!isPedago">
67+
<DrawerRouterOption to="/app/rollcall" name="Attendance" :fold="!active">
68+
<SvgQrCode
69+
:class="{
70+
'fill-selected-icon dark:fill-selected-icon':
71+
route.path.startsWith('/app/rollcall'),
72+
}"
73+
/>
74+
</DrawerRouterOption>
75+
</div>
7476
<DrawerRouterOption to="/app/retrospective" name="Retrospective" :fold="!active">
7577
<SvgNote
7678
:class="{
@@ -118,7 +120,7 @@
118120
</template>
119121

120122
<script lang="ts" setup>
121-
import { computed, ref } from 'vue';
123+
import { computed, onMounted, ref } from 'vue';
122124
import { useRoute } from 'vue-router';
123125
124126
import { useThemeStore } from '@/store/modules/theme.store';
@@ -138,6 +140,7 @@ import SvgNote from '@/components/common/svg/Note.vue';
138140
import SvgDark from '@/components/common/svg/Dark.vue';
139141
import SvgLight from '@/components/common/svg/Light.vue';
140142
import SvgLogout from '@/components/common/svg/Logout.vue';
143+
import { http } from '@/api/network/axios';
141144
142145
const route = useRoute();
143146
const themeStore = useThemeStore();
@@ -149,6 +152,19 @@ const isBlacklist = computed(() => blacklist.some((rgx) => rgx.test(route.path))
149152
const theme = computed(() => themeStore.theme);
150153
const active = ref(false);
151154
const modalLogoutActive = ref(false);
155+
const isPedago = ref(false);
156+
157+
onMounted(() => {
158+
getIsPedago();
159+
});
160+
161+
const getIsPedago = async () => {
162+
try {
163+
isPedago.value = await http.get(`/calls/is_pedagogue/`);
164+
} catch (error) {
165+
console.log(error);
166+
}
167+
};
152168
153169
const drawerAction = () => {
154170
active.value = !active.value;

0 commit comments

Comments
 (0)