내부 api 삭제
This commit is contained in:
@@ -27,12 +27,36 @@ export default function FindIdPage() {
|
||||
return Object.keys(next).length === 0;
|
||||
}
|
||||
|
||||
function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
|
||||
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
|
||||
e.preventDefault();
|
||||
if (!validateAll()) return;
|
||||
const mockUserId = `${name.trim()}@example.com`;
|
||||
setFoundUserId(mockUserId);
|
||||
setIsDoneOpen(true);
|
||||
|
||||
try {
|
||||
const response = await fetch('https://hrdi.coconutmeet.net/auth/find-id', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: name,
|
||||
phone: phone,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
console.error('아이디 찾기 실패:', errorData.error || response.statusText);
|
||||
setIsFailedOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
setFoundUserId(data.email);
|
||||
setIsDoneOpen(true);
|
||||
} catch (error) {
|
||||
console.error('아이디 찾기 오류:', error);
|
||||
setIsFailedOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user