From d8e494ae5d7e03c31f8ef51b0191a5f85c1bf70b Mon Sep 17 00:00:00 2001 From: chsua Date: Mon, 14 Aug 2023 18:17:10 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20(#280)=20=EB=B3=B8=EB=AC=B8=EC=82=AC?= =?UTF-8?q?=EC=A7=84=20=EB=93=B1=EB=A1=9D-=EC=82=AD=EC=A0=9C=20=ED=9B=84?= =?UTF-8?q?=20=EB=8F=99=EC=9D=BC=ED=95=9C=20=EC=82=AC=EC=A7=84=20=EC=97=85?= =?UTF-8?q?=EB=93=9C=EC=8B=9C=20=EC=97=85=EB=A1=9C=EB=93=9C=EB=90=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/PostForm/ContentImageSection/index.tsx | 6 ++++-- frontend/src/hooks/useContentImage.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/PostForm/ContentImageSection/index.tsx b/frontend/src/components/PostForm/ContentImageSection/index.tsx index 3f3291339..a7b53573e 100644 --- a/frontend/src/components/PostForm/ContentImageSection/index.tsx +++ b/frontend/src/components/PostForm/ContentImageSection/index.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent } from 'react'; +import { ChangeEvent, MutableRefObject } from 'react'; import { Size } from '@type/style'; @@ -10,12 +10,13 @@ interface ContentImageSectionProps { size: Size; contentImageHook: { contentImage: string; + contentInputRef: MutableRefObject; removeImage: () => void; handleUploadImage: (event: ChangeEvent) => void; }; } export default function ContentImageSection({ contentImageHook, size }: ContentImageSectionProps) { - const { contentImage, removeImage, handleUploadImage } = contentImageHook; + const { contentImage, contentInputRef, removeImage, handleUploadImage } = contentImageHook; return ( <> @@ -39,6 +40,7 @@ export default function ContentImageSection({ contentImageHook, size }: ContentI { const [contentImage, setContentImage] = useState(imageUrl); + const contentInputRef = useRef(null); const removeImage = () => { setContentImage(''); + if (contentInputRef.current) contentInputRef.current.value = ''; }; const handleUploadImage = (event: ChangeEvent) => { @@ -34,5 +36,5 @@ export const useContentImage = (imageUrl: string = '') => { }; }; - return { contentImage, removeImage, handleUploadImage }; + return { contentImage, contentInputRef, removeImage, handleUploadImage }; }; From 09865018411bd342c246770b3b3b1d2b16e69820 Mon Sep 17 00:00:00 2001 From: chsua Date: Mon, 14 Aug 2023 18:37:30 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20mock=20url=20=EC=8B=A4=EC=A0=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20url=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/post.ts | 3 +-- frontend/src/api/report.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/post.ts b/frontend/src/api/post.ts index 0bb20d6ff..87574912a 100644 --- a/frontend/src/api/post.ts +++ b/frontend/src/api/post.ts @@ -10,7 +10,6 @@ import { } from '@utils/fetch'; const BASE_URL = process.env.VOTOGETHER_BASE_URL ?? ''; -const MOCK_URL = process.env.VOTOGETHER_MOCKING_URL; export const transformPostResponse = (post: PostInfoResponse): PostInfo => { return { @@ -75,7 +74,7 @@ export const editPost = async (postId: number, updatedPost: FormData) => { }; export const deletePost = async (postId: number) => { - return await deleteFetch(`${MOCK_URL}/posts/${postId}`); + return await deleteFetch(`${BASE_URL}/posts/${postId}`); }; export const setEarlyClosePost = async (postId: number) => { diff --git a/frontend/src/api/report.ts b/frontend/src/api/report.ts index 64a46083e..bfb0353fc 100644 --- a/frontend/src/api/report.ts +++ b/frontend/src/api/report.ts @@ -2,7 +2,7 @@ import { ReportRequest } from '@type/report'; import { postFetch } from '@utils/fetch'; -const BASE_URL = process.env.VOTOGETHER_MOCKING_URL; +const BASE_URL = process.env.VOTOGETHER_BASE_URL; export const reportContent = async (reportData: ReportRequest) => { return await postFetch(`${BASE_URL}/report`, reportData);