Enabled a way for students to do assigned tasks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {Module} from "@/interfaces";
|
||||
import {Exam, UserSolution} from "@/interfaces/exam";
|
||||
import {Assignment} from "@/interfaces/results";
|
||||
import {create} from "zustand";
|
||||
|
||||
export interface ExamState {
|
||||
@@ -8,11 +9,13 @@ export interface ExamState {
|
||||
showSolutions: boolean;
|
||||
hasExamEnded: boolean;
|
||||
selectedModules: Module[];
|
||||
assignment?: Assignment;
|
||||
setHasExamEnded: (hasExamEnded: boolean) => void;
|
||||
setUserSolutions: (userSolutions: UserSolution[]) => void;
|
||||
setExams: (exams: Exam[]) => void;
|
||||
setShowSolutions: (showSolutions: boolean) => void;
|
||||
setSelectedModules: (modules: Module[]) => void;
|
||||
setAssignment: (assignment: Assignment) => void;
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
@@ -22,6 +25,7 @@ export const initialState = {
|
||||
showSolutions: false,
|
||||
selectedModules: [],
|
||||
hasExamEnded: false,
|
||||
assignment: undefined,
|
||||
};
|
||||
|
||||
const useExamStore = create<ExamState>((set) => ({
|
||||
@@ -31,6 +35,7 @@ const useExamStore = create<ExamState>((set) => ({
|
||||
setShowSolutions: (showSolutions: boolean) => set(() => ({showSolutions})),
|
||||
setSelectedModules: (modules: Module[]) => set(() => ({selectedModules: modules})),
|
||||
setHasExamEnded: (hasExamEnded: boolean) => set(() => ({hasExamEnded})),
|
||||
setAssignment: (assignment: Assignment) => set(() => ({assignment})),
|
||||
reset: () => set(() => initialState),
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user