diff --git a/apps/common/features/src/widgets/post/ui/post-action.tsx b/apps/common/features/src/widgets/post/ui/post-action.tsx index 9d4bae22f..6c31477bd 100644 --- a/apps/common/features/src/widgets/post/ui/post-action.tsx +++ b/apps/common/features/src/widgets/post/ui/post-action.tsx @@ -1,6 +1,11 @@ +import { useEffect, useState } from "react"; import { useRouter, usePathname } from "next/navigation"; -import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { + useConfirm, + useLocalStorage, +} from "@frontend-opensource/use-react-hooks"; import { Button } from "@common/components"; +import type { Board } from "@/entities/board"; type PostActionProps = { bbsId: string; @@ -12,13 +17,18 @@ type PostActionProps = { function PostAction({ children, handleDelete }: PostActionProps) { const router = useRouter(); const pathname = usePathname(); - const { confirm } = useConfirm(); + const [storedBbsInfo] = useLocalStorage("bbs-info", ""); + const [bbsInfo, setBbsInfo] = useState(null); const onDelete = async () => { if (await confirm("삭제하시겠습니까?")) handleDelete(); }; + useEffect(() => { + if (storedBbsInfo) setBbsInfo(JSON.parse(storedBbsInfo)); + }, [storedBbsInfo]); + return (
{children} @@ -38,14 +48,16 @@ function PostAction({ children, handleDelete }: PostActionProps) { > 수정 - + {bbsInfo?.ansUseYn === "Y" && ( + + )}