From 7e8bfec4ff18b2cd3322758624f1d0f451a3fee5 Mon Sep 17 00:00:00 2001 From: christie26 Date: Sat, 16 Dec 2023 10:02:53 +0900 Subject: [PATCH] Fix type error in updateProfile function --- .../frontend/src/components/profile/ProfileEditModal.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/project/frontend/src/components/profile/ProfileEditModal.tsx b/project/frontend/src/components/profile/ProfileEditModal.tsx index f4cf649e..aaddd315 100644 --- a/project/frontend/src/components/profile/ProfileEditModal.tsx +++ b/project/frontend/src/components/profile/ProfileEditModal.tsx @@ -45,8 +45,12 @@ export const ProfileEditModal: React.FC = ({ fetchData(); onClose(); } catch (error) { - alert(`${error.error.message}`); - console.error('Error saving changes:', error); + if (error instanceof Error) { + alert(`${error.message}`); + console.error('Error saving changes:', error); + } else { + console.error('Non-Error type error:', error); + } } }, [api, newData, onClose, fetchData]);