Skip to content

Commit

Permalink
[feat] 프로필 이미지 업로드 최종 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
KinDDoGGang committed Dec 6, 2023
1 parent 0698678 commit 44b9258
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/userInfo/editProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { UserInfoProps } from '@/context/UserInfoProvider.tsx';
import useModal from '@/hooks/useModal.ts';
import { uploadFile } from '@/api/room';
import { ImageListType } from 'react-images-uploading';
import { RoomFile } from '@/public/types/room';

interface ProfileProps {
_imageSrc: string;
Expand Down Expand Up @@ -70,11 +71,12 @@ export default function EditProfile({ _imageSrc, userInfo }: ProfileProps) {
try {
// gender,
const profileData = data as Profile;
profileData.profileId = userInfo.id || 0;
const imgResult = await uploadPhoto(imgFile as File);
profileData.profileId = imgResult?.id || userInfo?.id || 0;
profileData.description = data?.describe || '';
profileData.gender = buttonState.toUpperCase();
profileData.birthDate = formatDate(data.dateOfBirth, 'yyyymmdd') || profileData.birthDate;
if (imgFile) await uploadPhoto(imgFile as File);

await modifyProfile(profileData);
toast.error('Successfully saved');
closeModal();
Expand Down

0 comments on commit 44b9258

Please sign in to comment.