Feat: 리뷰디테일 페이지 권한 설정

This commit is contained in:
정현조 2024-10-01 17:10:06 +09:00
parent 1a64e28b69
commit 38f7add1b4

View File

@ -5,6 +5,7 @@ import useReviewDetailQuery from '@/queries/reviews/useReviewDetailQuery';
import useApproveReviewQuery from '@/queries/reviews/useApproveReviewQuery'; import useApproveReviewQuery from '@/queries/reviews/useApproveReviewQuery';
import useRejectReviewQuery from '@/queries/reviews/useRejectReviewQuery'; import useRejectReviewQuery from '@/queries/reviews/useRejectReviewQuery';
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import useIsAdminOrManager from '@/hooks/useIsAdminOrManager';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import 'slick-carousel/slick/slick.css'; import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css'; import 'slick-carousel/slick/slick-theme.css';
@ -34,6 +35,8 @@ export default function ReviewDetail(): JSX.Element {
const [activeTab, setActiveTab] = useState<'content' | 'images'>('content'); const [activeTab, setActiveTab] = useState<'content' | 'images'>('content');
const isAdminOrManager = useIsAdminOrManager(Number(projectId));
const handleApprove = () => { const handleApprove = () => {
approveReviewMutation.mutate(undefined, { approveReviewMutation.mutate(undefined, {
onSuccess: () => {}, onSuccess: () => {},
@ -134,7 +137,7 @@ export default function ReviewDetail(): JSX.Element {
<Link to={`/admin/${workspaceId}/reviews`}> <Link to={`/admin/${workspaceId}/reviews`}>
<Button variant="black"> </Button> <Button variant="black"> </Button>
</Link> </Link>
{reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECTED' && ( {isAdminOrManager && reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECTED' && (
<> <>
<Button <Button
variant="red" variant="red"