fix(nav): fix exam flow navigation

chore(zustand): refactor auth code for zustand store
This commit is contained in:
shafin-r
2025-09-09 20:45:30 +06:00
parent c3ead879ad
commit 108d34988d
11 changed files with 172 additions and 126 deletions

View File

@ -1,12 +1,11 @@
import { useRouter, usePathname } from "next/navigation";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { useExamStore } from "@/stores/examStore";
import { useTimerStore } from "@/stores/timerStore";
export function useExamExitGuard(type: string) {
export function useNavGuard(type: string) {
const { status, setStatus, cancelExam } = useExamStore();
const router = useRouter();
const pathname = usePathname();
const { stopTimer } = useTimerStore();
// Guard page render: always redirect if status invalid