generated from muhtadeetaron/nextjs-template
feat(zustand): add zustand stores for exam, timer and auth
This commit is contained in:
@ -11,10 +11,11 @@ import DestructibleAlert from "@/components/DestructibleAlert";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { LoginForm } from "@/types/auth";
|
||||
import { CircleAlert } from "lucide-react";
|
||||
import { useAuthStore } from "@/stores/authStore";
|
||||
|
||||
const LoginPage = () => {
|
||||
const router = useRouter();
|
||||
const { setToken } = useAuth();
|
||||
const { setToken } = useAuthStore();
|
||||
|
||||
const [form, setForm] = useState<LoginForm>({
|
||||
identifier: "",
|
||||
@ -88,7 +89,7 @@ const LoginPage = () => {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{error && <DestructibleAlert text={error} extraStyles="" />}
|
||||
{error && <DestructibleAlert text={error} />}
|
||||
|
||||
<h1 className="flex justify-center items-center gap-2 bg-green-200 p-4 rounded-full">
|
||||
<CircleAlert size={20} />
|
||||
|
||||
@ -11,6 +11,7 @@ import BackgroundWrapper from "@/components/BackgroundWrapper";
|
||||
import FormField from "@/components/FormField";
|
||||
import DestructibleAlert from "@/components/DestructibleAlert";
|
||||
import { RegisterForm } from "@/types/auth";
|
||||
import { useAuthStore } from "@/stores/authStore";
|
||||
|
||||
interface ValidationErrorItem {
|
||||
type: string;
|
||||
@ -27,7 +28,7 @@ interface CustomError extends Error {
|
||||
}
|
||||
|
||||
export default function RegisterPage() {
|
||||
const { setToken } = useAuth();
|
||||
const { setToken } = useAuthStore();
|
||||
const router = useRouter();
|
||||
const [form, setForm] = useState<RegisterForm>({
|
||||
full_name: "",
|
||||
|
||||
Reference in New Issue
Block a user