diff --git a/src/app/api/informations/[id]/route.ts b/src/app/api/informations/[id]/route.ts index a509b9a2..e9fe64d7 100644 --- a/src/app/api/informations/[id]/route.ts +++ b/src/app/api/informations/[id]/route.ts @@ -1,4 +1,4 @@ -import { revalidateTag } from "next/cache"; +import { revalidatePath } from "next/cache"; import { NextRequest } from "next/server"; /** @@ -149,8 +149,7 @@ export async function DELETE( throw new Error("Internal Server Error"); } - revalidateTag("getInformationList"); - + revalidatePath("/informations/list"); return response; } catch (e) { return new Response(JSON.stringify({ error: "Failed to delete data." }), { diff --git a/src/app/api/informations/route.ts b/src/app/api/informations/route.ts index a4ec9ee9..41ac8724 100644 --- a/src/app/api/informations/route.ts +++ b/src/app/api/informations/route.ts @@ -1,4 +1,4 @@ -import { revalidateTag } from "next/cache"; +import { revalidatePath } from "next/cache"; import { NextRequest } from "next/server"; // 정보 글 작성 @@ -7,9 +7,6 @@ export async function POST(request: NextRequest) { const cookie = request.cookies.get("access_token"); const formData = await request.formData(); - console.log("TEST 정보 글 작성"); - console.log(formData); - // Back-end API 호출 const response = await fetch( `${process.env.BACKEND_URL}/api/informations`, @@ -24,16 +21,14 @@ export async function POST(request: NextRequest) { ); if (!response.ok) { - throw new Error("Internal Server Error"); + throw new Error(response.statusText); } - // Revalidate the cache for the list page and redirect the user. - // TODO: 수정 필요 - revalidateTag("getInformationList"); - + // Revalidate the cache + revalidatePath("/informations/list"); return response; - } catch (e) { - return new Response(JSON.stringify({ error: "Failed to write data." }), { + } catch (e: any) { + return new Response(JSON.stringify({ error: e.message }), { status: 500, // Internal Server Error headers: { "Content-Type": "application/json", diff --git a/src/components/informations/detail/ImageViewer.tsx b/src/components/informations/detail/ImageViewer.tsx index ca91b957..55521143 100644 --- a/src/components/informations/detail/ImageViewer.tsx +++ b/src/components/informations/detail/ImageViewer.tsx @@ -8,17 +8,12 @@ interface Props { setMainImageIndex: (index: number) => void; } -const ImageViewer = ({ - images, - mainImageIndex, - scrollHook, - setMainImageIndex, -}: Props) => { +const ImageViewer = ({ images, scrollHook, setMainImageIndex }: Props) => { return (
image.imageStatus === "썸네일")[0].address } @@ -46,7 +41,7 @@ const ImageViewer = ({ {images.map((image, index) => (
{ setMainImageIndex(index); }} diff --git a/src/components/informations/detail/InformationViewer.tsx b/src/components/informations/detail/InformationViewer.tsx index d8801475..56dc5981 100644 --- a/src/components/informations/detail/InformationViewer.tsx +++ b/src/components/informations/detail/InformationViewer.tsx @@ -126,11 +126,11 @@ const InformationViewer = async ({ informationId }: Props) => { /> ))}
-
+
생생한 혼플 TIP
- {data.tip.split(" ").map((tip, index) => ( + {data.tip.split(";").map((tip, index) => (
  • editorStore.setEditor({ content: e.target.value })} @@ -157,7 +155,6 @@ const InformationEditor = ({ editorStore.changeTip(index, e.target.value)} required={true} + onKeyDown={(e) => { + if (e.key === ";") { + e.preventDefault(); + e.persist(); + } + }} /> ))}
  • @@ -223,7 +225,7 @@ const InformationEditor = ({