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); }; } }