generated from muhtadeetaron/nextjs-template
fix(nav): fix exam flow navigation
chore(zustand): refactor auth code for zustand store
This commit is contained in:
@ -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
|
||||
Reference in New Issue
Block a user