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

@ -6,7 +6,6 @@ import { useRouter } from "next/navigation";
import Image from "next/image";
import BackgroundWrapper from "@/components/BackgroundWrapper";
import FormField from "@/components/FormField";
import { login } from "@/lib/auth";
import DestructibleAlert from "@/components/DestructibleAlert";
import { LoginForm } from "@/types/auth";
import { CircleAlert } from "lucide-react";
@ -14,7 +13,7 @@ import { useAuthStore } from "@/stores/authStore";
const LoginPage = () => {
const router = useRouter();
const { setToken } = useAuthStore();
const { login } = useAuthStore();
const [form, setForm] = useState<LoginForm>({
identifier: "",
@ -28,7 +27,7 @@ const LoginPage = () => {
try {
setIsLoading(true);
setError(null);
await login(form, setToken);
await login(form);
router.replace("/home");
} catch (err: unknown) {
console.error(err);