From b5bd2e02d7d8fb348ec9b9f45c870d946816fbef Mon Sep 17 00:00:00 2001 From: Primakov Alexandr Alexandrovich Date: Sun, 15 Dec 2024 17:03:14 +0300 Subject: [PATCH] not create access token if not teacher --- src/pages/lesson-details.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/lesson-details.tsx b/src/pages/lesson-details.tsx index 57409c8..6cf8b8f 100644 --- a/src/pages/lesson-details.tsx +++ b/src/pages/lesson-details.tsx @@ -24,6 +24,8 @@ import { StudentList, BreadcrumbsWrapper, } from './style' +import { useAppSelector } from '../__data__/store' +import { isTeacher } from '../utils/user' export function getGravatarURL(email, user) { if (!email) return void 0 @@ -37,6 +39,8 @@ export function getGravatarURL(email, user) { const LessonDetail = () => { const { lessonId, courseId } = useParams() const canvRef = useRef(null) + const user = useAppSelector((s) => s.user) + const { isFetching, data: accessCode, @@ -45,6 +49,7 @@ const LessonDetail = () => { } = api.useCreateAccessCodeQuery( { lessonId }, { + skip: !isTeacher(user), pollingInterval: Number(getConfigValue('journal.polling-interval')) || 3000, skipPollingIfUnfocused: true,