import { useState } from 'react'; import { FormEvent } from 'react'; export default function SignIn() { const [userName, setUserName] = useState(''); const [password, setPassword] = useState(''); const handleSubmit = async (e: FormEvent) => { e.preventDefault(); // Prevent the default form submission const data = { userName, password, }; try { const response = await fetch('https://api.teachertrainingkolkata.in//api/sign-in', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data), }); if (!response.ok) { throw new Error('Network response was not ok'); } const result = await response.json(); console.log('Success:', result); } catch (error) { console.error('Error:', error); } }; return (
setUserName(e.target.value)} />
setPassword(e.target.value)}/>

); }