From 27f8f28c90617c2019fcccb82e558fbe2064900f Mon Sep 17 00:00:00 2001 From: myeongheonhong Date: Wed, 23 Aug 2023 17:32:51 +0900 Subject: [PATCH] =?UTF-8?q?[=20fix=20]=20=EB=B9=8C=EB=93=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/wishes/getPresignedURL.ts | 2 +- hooks/wishes/useUploadItemInfo.ts | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/api/wishes/getPresignedURL.ts b/api/wishes/getPresignedURL.ts index 9ecce474..d4d85252 100644 --- a/api/wishes/getPresignedURL.ts +++ b/api/wishes/getPresignedURL.ts @@ -1,5 +1,5 @@ +import PATH from '@/constant/path'; import { client } from '../common/axios'; -import PATH from '../common/path'; export const getPresignedURL = async (fileName: string | undefined) => { const accessToken = localStorage.getItem('accessToken'); diff --git a/hooks/wishes/useUploadItemInfo.ts b/hooks/wishes/useUploadItemInfo.ts index c6d1e503..68724eb1 100644 --- a/hooks/wishes/useUploadItemInfo.ts +++ b/hooks/wishes/useUploadItemInfo.ts @@ -6,7 +6,7 @@ import { useMutation, useQuery } from 'react-query'; export default function useUploadItemInfo() { const [imageFile, setImageFile] = useState(null); - const [previewImage, setPreviewImage] = useState(''); + const [previewImage, setPreviewImage] = useState(''); const [preSignedURL, setPreSignedURL] = useState(''); const { data } = useQuery(QUERY_KEY.PRE_SIGNED_URL, () => getPresignedURL(imageFile?.name), { @@ -19,11 +19,7 @@ export default function useUploadItemInfo() { } }, [data]); - const { mutate } = useMutation(() => uploadPresignedURL(data?.data?.data?.signedUrl, imageFile), { - onSuccess: () => { - // setPreSignedURL() - }, - }); + const { mutate } = useMutation(() => uploadPresignedURL(data?.data?.data?.signedUrl, imageFile)); console.log(data); @@ -35,7 +31,7 @@ export default function useUploadItemInfo() { const reader = new FileReader(); imageFile && reader.readAsDataURL(imageFile); reader.onloadend = () => { - setPreviewImage(reader.result); + setPreviewImage(reader.result as string); }; } }