feat: 권한 버튼 생성 및 적용

This commit is contained in:
2025-05-20 17:33:28 +09:00
parent 6f2a5c6308
commit bc4513d3fc
8 changed files with 118 additions and 82 deletions
+16 -17
View File
@@ -22,6 +22,7 @@ import {
Skeleton,
} from "@common/components";
import { BoardApi } from "@/entities/board";
import { AuthorityButton } from "@/entities/menu-authority";
import { PostApi, type Post, type PostParams } from "@/entities/post";
import { ENDPOINT } from "@/shared/config";
import { useMenuStore, usePrompt } from "@/shared/lib";
@@ -33,9 +34,7 @@ function PostPage({ bbsId }: { bbsId: string }) {
const router = useRouter();
const pathname = usePathname();
const { prompt } = usePrompt();
const { bbsInfo, pageMenuAuthority, setBbsInfo } = useMenuStore(
(state) => state,
);
const { bbsInfo, setBbsInfo } = useMenuStore((state) => state);
const thumbRefs = useRef<Map<number, string>>(new Map());
const [postParams, setPostParams] = useState<PostParams>({
@@ -174,20 +173,20 @@ function PostPage({ bbsId }: { bbsId: string }) {
<div className="flex w-full items-center justify-between">
<h3 className="text-2xl font-medium text-label">콘텐츠 목록</h3>
<div className="flex gap-2">
{pageMenuAuthority?.regAuthrtYn === "Y" && (
<Button onClick={() => router.push(`${pathname}/register`)}>
등록
</Button>
)}
{pageMenuAuthority?.delAuthrtYn === "Y" && (
<Button
color="red"
onClick={onPostDelete}
disabled={!table.getFilteredSelectedRowModel().rows.length}
>
선택삭제
</Button>
)}
<AuthorityButton
authority="regAuthrtYn"
onClick={() => router.push(`${pathname}/register`)}
>
등록
</AuthorityButton>
<AuthorityButton
authority="delAuthrtYn"
color="red"
onClick={onPostDelete}
disabled={!table.getFilteredSelectedRowModel().rows.length}
>
선택삭제
</AuthorityButton>
<Select
value={table.getState().pagination.pageSize.toString()}
onValueChange={(value) => {