Skip to content

Commit 02c2596

Browse files
authored
✨feat:커뮤니티 수정 및 삭제 ROLEID로 판별 (#601)
1 parent e1d7e4e commit 02c2596

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/features/communitiy-detail-content-box/indexCss.ts

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const CommunityImage = styled.img`
7575
`;
7676

7777
export const EditDeleteBtnCon = styled.div`
78+
height: 200px;
7879
display: flex;
7980
justify-content: center;
8081
align-items: center;

src/features/communitiy-detail-content-box/logic/useCommunityDetailContent.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ interface useCommunityDetailContentReturn {
1414
export const useCommunityDetailContent = (content_id: number): useCommunityDetailContentReturn => {
1515
const [communityWriterData, setCommunityWriterData] = useState();
1616
const [communityDetailData, setCommunityDetailData] = useState();
17-
const myLoginId = useLoginStore((state) => state.myLoginId);
17+
const myRoleId = useLoginStore((state) => state.myRoleId);
1818
const loginType = useLoginStore((state) => state.loginType);
1919

2020
// 커뮤니티 상세 데이터 가져오기
2121
const { data: detailData } = useCommunityDetail(content_id);
2222
const { data: writerData } = usePersonProfileQuery(detailData?.writer_id ?? '');
2323

2424
// 내 콘텐츠 여부 확인
25-
const isMyContent = detailData ? loginType === 'ROLE_VOLUNTEER' && detailData.writer_id === myLoginId : false;
25+
const isMyContent = detailData ? loginType === 'ROLE_VOLUNTEER' && detailData.writer_id === myRoleId : false;
2626

2727
// 데이터 업데이트되면 리랜더링
2828
useEffect(() => {

src/features/community-create-box/logic/useCreateCommunity.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const useCreateCommunity = ({ content_id }: { content_id?: number }): use
4545
const [contentText, setContentText] = useState<string>();
4646
const [imageURL, setImageURL] = useState<string | null>(null);
4747
const [isMyContent, setIsMyContent] = useState<boolean>(false);
48-
const myLoginId = useLoginStore((state) => state.myLoginId);
48+
const myRoleId = useLoginStore((state) => state.myRoleId);
4949
const navigate = useNavigate();
5050

5151
// 글 작성 완료
@@ -91,7 +91,7 @@ export const useCreateCommunity = ({ content_id }: { content_id?: number }): use
9191
// 수정 모드일 때만 데이터를 체크하도록 수정
9292
// 새로 작성하는 글은 post 할 때 id가 부여되기 때문에 content_id가 없어서 400 에러가 발생한다고 판단
9393
if (content_id && data) {
94-
if (data.writer_id === myLoginId) {
94+
if (data.writer_id === myRoleId) {
9595
setIsMyContent(true);
9696
setTitleText(data.title);
9797
setContentText(data.content);
@@ -103,7 +103,7 @@ export const useCreateCommunity = ({ content_id }: { content_id?: number }): use
103103
navigate('/community');
104104
}
105105
}
106-
}, [data, myLoginId, navigate, content_id]);
106+
}, [data, myRoleId, navigate, content_id]);
107107

108108
return { titleText, setTitleText, contentText, setContentText, onClickPost, imageURL };
109109
};

0 commit comments

Comments
 (0)