Skip to content

Commit

Permalink
Merge pull request #223 from bsideproject/feature/user
Browse files Browse the repository at this point in the history
[feat] 프로필 이미지 업로드 최종 수정
  • Loading branch information
KinDDoGGang authored Dec 6, 2023
2 parents 2f559f1 + 44b9258 commit c4622ff
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 c4622ff

Please sign in to comment.