generated from muhtadeetaron/nextjs-template
feat(nav): add flow-guarding for exam result screens
This commit is contained in:
@ -7,10 +7,14 @@ import { ExamResult } from "@/types/exam";
|
||||
|
||||
// Result type (based on your API response)
|
||||
|
||||
type ExamStatus = "not-started" | "in-progress" | "finished";
|
||||
|
||||
interface ExamState {
|
||||
test: Test | null;
|
||||
answers: Answer[];
|
||||
result: ExamResult | null;
|
||||
status: ExamStatus;
|
||||
setStatus: (status: ExamStatus) => void;
|
||||
|
||||
startExam: (testType: string, testId: string) => Promise<Test | null>;
|
||||
setAnswer: (questionIndex: number, answer: Answer) => void;
|
||||
@ -23,6 +27,8 @@ export const useExamStore = create<ExamState>((set, get) => ({
|
||||
test: null,
|
||||
answers: [],
|
||||
result: null,
|
||||
status: "not-started",
|
||||
setStatus: (status) => set({ status }),
|
||||
|
||||
// start exam
|
||||
startExam: async (testType: string, testId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user