diff --git a/src/components/createPage/PostForm/index.tsx b/src/components/createPage/PostForm/index.tsx index bb2c3c92..c2878ed3 100644 --- a/src/components/createPage/PostForm/index.tsx +++ b/src/components/createPage/PostForm/index.tsx @@ -141,16 +141,19 @@ const PostForm = ({ category }: PostFormProps) => { // 이미지 관련 const [imageUrlsArray, setImageUrlsArray] = useState<{ activityImageUrl: string }[]>([]); + const [isImageUploadSuccess, setIsImageUploadSuccess] = useState(false); const { mutate: postFormImageMutation } = useMutation({ mutationFn: (uploadedFiles: File[]) => Activities.createImage(uploadedFiles), onSuccess: (uploadedImageUrls) => { setImageUrlsArray(uploadedImageUrls); + setIsImageUploadSuccess(false); }, }); const handleUpdateFiles = (uploadedFiles: File[]) => { postFormImageMutation(uploadedFiles); + setIsImageUploadSuccess(true); }; // 유저 데이터 관련 @@ -216,9 +219,9 @@ const PostForm = ({ category }: PostFormProps) => { {recruitmentTypes.isOfflineOrOnline(price) && ( @@ -253,7 +256,7 @@ const PostForm = ({ category }: PostFormProps) => { name='discord' label='디스코드 링크' placeholder='https://discord.gg/초대코드' - maxLength={50} + maxLength={30} /> )} @@ -298,6 +301,7 @@ const PostForm = ({ category }: PostFormProps) => { theme='fill' size='medium' color='purple' + isDisabled={isImageUploadSuccess} onClick={handleSubmit(handleEditFormData)} > 등록 @@ -314,6 +318,7 @@ const PostForm = ({ category }: PostFormProps) => { theme='fill' size='large' color='purple' + isDisabled={isImageUploadSuccess} onClick={handleSubmit(handleEditFormData)} > 등록 diff --git a/src/components/editPage/EditForm/index.tsx b/src/components/editPage/EditForm/index.tsx index 690a87a6..817cf1e5 100644 --- a/src/components/editPage/EditForm/index.tsx +++ b/src/components/editPage/EditForm/index.tsx @@ -187,16 +187,19 @@ const EditForm = ({ category, activityDetailData }: EditFormProps) => { // 이미지 관련 const [imageUrlsArray, setImageUrlsArray] = useState<{ activityImageUrl: string }[]>([]); + const [isImageUploadSuccess, setIsImageUploadSuccess] = useState(false); const { mutate: postFormImageMutation } = useMutation({ mutationFn: (uploadedFiles: File[]) => Activities.createImage(uploadedFiles), onSuccess: (uploadedImageUrls) => { setImageUrlsArray(uploadedImageUrls); + setIsImageUploadSuccess(false); }, }); const handleUpdateFiles = (uploadedFiles: File[]) => { postFormImageMutation(uploadedFiles); + setIsImageUploadSuccess(true); }; // 수정 버튼 클릭 후 데이터 가공 관련 @@ -346,6 +349,7 @@ const EditForm = ({ category, activityDetailData }: EditFormProps) => { theme='fill' size='medium' color='purple' + isDisabled={isImageUploadSuccess} onClick={handleSubmit(handleEditFormData)} > 수정 @@ -362,6 +366,7 @@ const EditForm = ({ category, activityDetailData }: EditFormProps) => { theme='fill' size='large' color='purple' + isDisabled={isImageUploadSuccess} onClick={handleSubmit(handleEditFormData)} > 수정 @@ -374,9 +379,9 @@ const EditForm = ({ category, activityDetailData }: EditFormProps) => { 확인