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