프로필 페이지에서 성별과 생년월일을 한번 입력하면 못바꾸게 해뒀는데 사용자 피드백을 받아보니 그게 가끔 잘못 누르는가보다. 보통 나는 입력하고 변경버튼 누르기전에 확인을 하는데.. 사람마다 다른거니 그럴수 있지
// 성별 저장 함수
const clickSaveSexTypeHandler = async () => {
const result = await Swal.fire({
title: `선택한 성별이 ${sexType}인가요?`,
text: '설정한 이후는 변경이 어려워요.',
icon: 'question',
showCancelButton: true,
confirmButtonText: '확인',
cancelButtonText: '취소',
confirmButtonColor: '#0051FF',
cancelButtonColor: '#d33',
});
if (result.isConfirmed && auth.currentUser && userProfile) {
await updateDoc(doc(db, 'users', auth.currentUser.uid), {
sexType: sexType,
});
setUserProfile({
...userProfile,
sexType: sexType,
});
}
};
// 생년월일 저장 함수
const clickSaveBirthDateHandler = async () => {
const result = await Swal.fire({
title: `생년월일이 ${newBirthDate} 인가요?`,
text: '설정한 이후는 변경이 어려워요.',
icon: 'question',
showCancelButton: true,
confirmButtonText: '확인',
cancelButtonText: '취소',
confirmButtonColor: '#0051FF',
cancelButtonColor: '#d33',
});
if (result.isConfirmed && auth.currentUser && newBirthDate) {
await updateDoc(doc(db, 'users', auth.currentUser.uid), {
birthdate: newBirthDate,
});
setUserProfile({
...userProfile,
birthDate: newBirthDate,
});
}
};

각각 함수에 확인창을 하나 만들었다.
역시 sweet alert는 쉬운거같다...
그러나, cross-origin-opener-policy policy would block the window.closed call. 같은 소셜 로그인 이슈와... 로그인 후 로그인페이지 관련은 와 하루종일 에러핸들링을 해도 좀처럼 해결이 안된다.. 하..
오늘의 한줄평 : 열심히 해보자.