Skip to content

Commit 412b83d

Browse files
authored
Merge pull request #119 from oodd-team/feat/OD-148
[OD-148] post 도메인 응답 dto 수정
2 parents 2083817 + bb6f04d commit 412b83d

8 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/apis/post/dto.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface PostBase {
2525
content: string;
2626
postImages: PostImage[];
2727
postStyletags: string[];
28-
postClothings: PostClothing[] | null;
28+
postClothings?: PostClothing[] | null;
2929
isRepresentative: boolean;
3030
}
3131
export interface CreatePostData extends PostBase {}
@@ -36,7 +36,7 @@ export interface PostSummary {
3636
createdAt: Date;
3737
isPostLike: boolean;
3838
user: User;
39-
requestStatus: boolean;
39+
requestStatus: boolean | null;
4040
}
4141
export interface GetPostListData {
4242
post: PostSummary[];
@@ -60,7 +60,7 @@ export interface GetUserPostListData {
6060
meta: PaginationMeta;
6161
}
6262
export interface ModifyPostData extends PostBase {
63-
postId: number;
63+
id: number;
6464
userId: number;
6565
}
6666
export interface GetPostDetailData extends PostBase {

src/apis/util/dto.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ export interface PaginationMeta {
1818
last_page: number;
1919
hasPreviousPage: boolean;
2020
hasNextPage: boolean;
21-
totalItems: number; // 추가
2221
}

src/components/PostItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import Message from '@components/Icons/Message';
99
import type { PostItemProps } from './dto';
1010
import { PostItemLayout, PostImageContainer, PostImage, LikesCountStyledText, LikesOverlay, Pin } from './style';
1111

12-
const PostItem: React.FC<PostItemProps> = ({ post, isMyPost = true }) => {
12+
const PostItem: React.FC<PostItemProps> = ({ post }) => {
1313
const navigate = useNavigate();
1414
const postImageUrl = post.imageUrl;
1515

1616
const handlePostItemClick = () => {
17-
const path = isMyPost ? `/my-post/${post.id}` : `/post/${post.id}`;
17+
const path = `/post/${post.id}`;
1818
navigate(path);
1919
};
2020

src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { postUserBlockApi } from '@apis/user-block';
3232
import { PostUserBlockRequest } from '@apis/user-block/dto';
3333
import { createCommentApi, deleteCommentApi, getCommentListApi } from '@apis/post-comment';
3434
import { handleError } from '@apis/util/handleError';
35+
import { getCurrentUserId } from '@utils/getCurrentUserId';
3536

3637
const LikeCommentBottomSheetContent: React.FC<LikeCommentBottomSheetProps> = ({ tab, likeCount, commentCount }) => {
3738
const [activeTab, setActiveTab] = useState<'likes' | 'comments'>(tab);
@@ -202,7 +203,7 @@ const LikeCommentBottomSheetContent: React.FC<LikeCommentBottomSheetProps> = ({
202203

203204
// 유저 차단 api
204205
const postUserBlock = async () => {
205-
const storedUserId = localStorage.getItem('my_id');
206+
const storedUserId = getCurrentUserId();
206207

207208
// 사용자 ID 또는 선택된 댓글이 없으면 함수 종료
208209
if (!storedUserId || !selectedComment) {
@@ -317,7 +318,7 @@ const LikeCommentBottomSheetContent: React.FC<LikeCommentBottomSheetProps> = ({
317318
// 유저 클릭한 경우
318319
const handleUserClick = (userId: number) => {
319320
// 로컬 스토리지에서 사용자 ID 가져오기
320-
const myUserId = localStorage.getItem('my_id'); // 로컬 스토리지에 저장된 사용자 ID를 가져옴
321+
const myUserId = getCurrentUserId(); // 로컬 스토리지에 저장된 사용자 ID를 가져옴
321322

322323
if (String(myUserId) === String(userId)) {
323324
// 나인 경우

src/pages/Post/PostBase/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { GetPostDetailResponse } from '@apis/post/dto';
4848

4949
import { getPostDetailApi } from '@apis/post';
5050
import { togglePostLikeStatusApi } from '@apis/post-like';
51+
import { getCurrentUserId } from '@utils/getCurrentUserId';
5152

5253
const PostBase: React.FC<PostBaseProps> = ({ onClickMenu }) => {
5354
const { postId } = useParams<{ postId: string }>();
@@ -62,7 +63,7 @@ const PostBase: React.FC<PostBaseProps> = ({ onClickMenu }) => {
6263
const [activeTab, setActiveTab] = useState<'likes' | 'comments'>('likes'); // activeTab state
6364

6465
const nav = useNavigate();
65-
const userId = localStorage.getItem('my_id');
66+
const userId = getCurrentUserId();
6667

6768
useEffect(() => {
6869
setPostId(Number(postId));

src/pages/PostImageSelect/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import PhotoBig from '../../assets/default/photo-big.svg';
2424

2525
import { ImageSelectModalProps } from './dto';
2626
import heic2any from 'heic2any';
27+
import { getCurrentUserId } from '@utils/getCurrentUserId';
2728

2829
const PostImageSelect: React.FC<ImageSelectModalProps> = () => {
2930
const [images, setImages] = useRecoilState(postImagesAtom);
@@ -35,7 +36,7 @@ const PostImageSelect: React.FC<ImageSelectModalProps> = () => {
3536
const fileInputRef = useRef<HTMLInputElement | null>(null);
3637
const location = useLocation();
3738
const navigate = useNavigate();
38-
const userId = localStorage.getItem('my_id');
39+
const userId = getCurrentUserId();
3940

4041
const handleClose = () => {
4142
navigate(`/profile/${userId}`);

src/pages/PostInstaFeedSelect/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ModalProps } from '../../components/Modal/dto';
1414
import X from '../../assets/default/x.svg';
1515

1616
import { InstaFeedSelectModalProps, Post } from './dto';
17+
import { getCurrentUserId } from '@utils/getCurrentUserId';
1718

1819
const PostInstaFeedSelect: React.FC<InstaFeedSelectModalProps> = () => {
1920
const [isSuccessModalOpen, setIsSuccessModalOpen] = useState(true);
@@ -22,7 +23,7 @@ const PostInstaFeedSelect: React.FC<InstaFeedSelectModalProps> = () => {
2223
const [posts, setPosts] = useState<Post[]>([]); // Post 타입으로 지정
2324
const [, setImages] = useRecoilState(postImagesAtom);
2425
const navigate = useNavigate();
25-
const userId = localStorage.getItem('my_id');
26+
const userId = getCurrentUserId();
2627

2728
// 인스타그램 데이터 가져오는 함수
2829
const fetchInstagramData = async (accessToken: string) => {

src/pages/PostUpload/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { ref, uploadBytes, getDownloadURL } from 'firebase/storage';
5151
import { storage } from '../../config/firebaseConfig';
5252
import { getPostDetailApi, createPostApi, modifyPostApi } from '../../apis/post';
5353
import { handleError } from '../../apis/util/handleError';
54+
import { getCurrentUserId } from '@utils/getCurrentUserId';
5455

5556
const PostUpload: React.FC<PostUploadModalProps> = () => {
5657
const [selectedImages, setSelectedImages] = useRecoilState(postImagesAtom);
@@ -66,7 +67,7 @@ const PostUpload: React.FC<PostUploadModalProps> = () => {
6667
const [modalContent, setModalContent] = useState('알 수 없는 오류입니다.\n관리자에게 문의해 주세요.');
6768
const location = useLocation();
6869
const navigate = useNavigate();
69-
const userId = localStorage.getItem('my_id');
70+
const userId = getCurrentUserId();
7071

7172
const styletags = [
7273
'classic',

0 commit comments

Comments
 (0)