Skip to content

Commit

Permalink
Fix teachers not being able to see create exam page.
Browse files Browse the repository at this point in the history
Signed-off-by: Aliwoto <[email protected]>
  • Loading branch information
ALiwoto committed Sep 23, 2024
1 parent 82abe44 commit 08633eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const App: React.FC = () => {
/>
<Route
path="/createExam"
element={apiClient.canCreateTopics() ? <CreateExamPage /> : <Navigate to="/dashboard" />}
element={apiClient.canCreateExams() ? <CreateExamPage /> : <Navigate to="/dashboard" />}
/>
<Route
path="/examInfo"
Expand Down
4 changes: 4 additions & 0 deletions src/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,10 @@ class ExamSphereAPIClient extends UserApi {
return this.isOwner() || this.isAdmin();
}

public canCreateExams(): boolean {
return this.isTeacherOrAdmin();
}

public canViewExamInfo(): boolean {
return this.isLoggedIn();
}
Expand Down

0 comments on commit 08633eb

Please sign in to comment.