generated from muhtadeetaron/nextjs-template
fix(api): fix api endpoint logic #2
This commit is contained in:
@ -10,13 +10,14 @@ import { login } from "@/lib/auth";
|
||||
import DestructibleAlert from "@/components/DestructibleAlert";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { LoginForm } from "@/types/auth";
|
||||
import { CircleAlert } from "lucide-react";
|
||||
|
||||
const LoginPage = () => {
|
||||
const router = useRouter();
|
||||
const { setToken } = useAuth();
|
||||
|
||||
const [form, setForm] = useState<LoginForm>({
|
||||
email: "",
|
||||
identifier: "",
|
||||
password: "",
|
||||
});
|
||||
|
||||
@ -71,11 +72,11 @@ const LoginPage = () => {
|
||||
<div className="flex flex-col justify-between gap-10">
|
||||
<div className="flex flex-col w-full gap-5">
|
||||
<FormField
|
||||
title="Email Address"
|
||||
value={form.email}
|
||||
title="Email \ Username"
|
||||
value={form.identifier}
|
||||
placeholder="Enter your email address..."
|
||||
handleChangeText={(value) =>
|
||||
setForm({ ...form, email: value })
|
||||
setForm({ ...form, identifier: value })
|
||||
}
|
||||
/>
|
||||
<FormField
|
||||
@ -87,9 +88,13 @@ const LoginPage = () => {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{error && <DestructibleAlert text={error} extraStyles="" />}
|
||||
|
||||
<h1 className="flex justify-center items-center gap-2 bg-green-200 p-4 rounded-full">
|
||||
<CircleAlert size={20} />
|
||||
Your login details will be remembered.
|
||||
</h1>
|
||||
|
||||
<button
|
||||
onClick={loginUser}
|
||||
disabled={isLoading}
|
||||
|
||||
Reference in New Issue
Block a user