Files
Mav-Mobile-UI/src/components/SettingForms/NPED/NPEDFields.tsx

65 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-08-18 16:04:03 +01:00
import { Form, Formik, Field } from "formik";
import FormGroup from "../components/FormGroup";
import type { NPEDFieldType } from "../../../types/types";
2025-08-22 10:38:28 +01:00
import { useNPEDAuth } from "../../../hooks/useNPEDAuh";
2025-08-18 16:04:03 +01:00
const NPEDFields = () => {
2025-08-22 10:38:28 +01:00
const { signIn, isError } = useNPEDAuth();
2025-08-18 16:04:03 +01:00
const initialValues = {
username: "",
password: "",
clientId: "",
};
const handleSubmit = (values: NPEDFieldType) => {
2025-08-22 10:38:28 +01:00
console.log(isError);
signIn(values);
2025-08-18 16:04:03 +01:00
};
return (
<Formik initialValues={initialValues} onSubmit={handleSubmit}>
<Form className="flex flex-col space-y-2">
<FormGroup>
<label htmlFor="username">Username</label>
<Field
name="username"
type="text"
id="username"
placeholder="NPED username"
className="p-1.5 border border-gray-400 rounded-lg"
/>
</FormGroup>
<FormGroup>
<label htmlFor="password">Password</label>
<Field
name="password"
type="password"
id="password"
placeholder="NPED Password"
className="p-1.5 border border-gray-400 rounded-lg"
/>
</FormGroup>
<FormGroup>
<label htmlFor="clientId">Client ID</label>
<Field
name="clientId"
type="text"
id="clientId"
placeholder="NPED client ID"
className="p-1.5 border border-gray-400 rounded-lg"
/>
</FormGroup>
<button
type="submit"
className="w-1/4 text-white bg-green-700 hover:bg-green-800 font-small rounded-lg text-sm px-2 py-2.5"
>
Login
</button>
</Form>
</Formik>
);
};
export default NPEDFields;