Skip to content

Commit a1ff3e8

Browse files
authored
Merge pull request #35 from wafflestudio/seoyeon
fix: mypage prod link default image not showing
2 parents f12e424 + e059274 commit a1ff3e8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/pages/MyPage.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ const ProfileCard = ({ onClickInterest } : { onClickInterest: () => void }) => {
1818
const { user, updateUsername, setProfileImg } = useAuth();
1919
const { interestCategories } = useUserData();
2020
const { timetables } = useTimetable();
21-
const [profilePreviewUrl, setProfilePreviewUrl] = useState<string>(
22-
user ? user.profileImageUrl : "/assets/defaultProfile.png",
23-
);
21+
const [profilePreviewUrl, setProfilePreviewUrl] = useState<string>(user?.profileImageUrl || '/assets/defaultProfile.png');
2422
const [imgFile, setImgFile] = useState<File | null>(null);
2523
const [, setIsDefaultProfile] = useState<boolean>(false);
2624
const [username, setUsername] = useState<string>(
@@ -29,10 +27,10 @@ const ProfileCard = ({ onClickInterest } : { onClickInterest: () => void }) => {
2927
const [isEditmode, setIsEditmode] = useState<boolean>(false);
3028
const navigate = useNavigate();
3129

32-
const handleImageError = (e: React.SyntheticEvent<HTMLImageElement, Event>) => {
33-
console.log("Failed to load image:", e.currentTarget.src); // See what URL is breaking
34-
setProfilePreviewUrl("/assets/defaultProfile.png");
35-
};
30+
const handleImageError = () => {
31+
setProfilePreviewUrl("/assets/defaultProfile.png");
32+
};
33+
3634
const handleImageChange = (e: React.ChangeEvent<HTMLInputElement>) => {
3735
const file = e.target.files?.[0];
3836
if (!file) return;

0 commit comments

Comments
 (0)