From 95033bdaa0d50d3a4f6dcb4e36d7d42945f266d6 Mon Sep 17 00:00:00 2001 From: jeongmingong Date: Sat, 20 Apr 2024 23:57:19 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20Fix:=20=ED=9A=8C=EA=B3=A0=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=9D=BC=20=EB=82=A0=EC=A7=9C=20=ED=98=95=EC=8B=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=83=9D=EC=84=B1=EC=9E=90=20?= =?UTF-8?q?=EB=8B=89=EB=84=A4=EC=9E=84=20=EB=A0=8C=EB=8D=94=EB=A7=81=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/@types/Retrospectives.ts | 1 + src/api/@types/User.ts | 22 +++++++-------- src/api/axiosConfig.tsx | 2 +- src/components/RetroList/ContentsList.tsx | 28 +++++++++---------- .../createRetro/modal/ImageUpload.tsx | 23 +++++++++------ src/pages/MyPage.tsx | 2 +- src/pages/RetroListPage.tsx | 4 +++ 7 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/api/@types/Retrospectives.ts b/src/api/@types/Retrospectives.ts index d0da201..0514f96 100644 --- a/src/api/@types/Retrospectives.ts +++ b/src/api/@types/Retrospectives.ts @@ -46,6 +46,7 @@ export interface GetRetrospectiveResponseNodes { startDate: string; createdDate: string; updatedDate: string; + username: string; } export interface GetRetrospectiveData { diff --git a/src/api/@types/User.ts b/src/api/@types/User.ts index dff78c6..e070478 100644 --- a/src/api/@types/User.ts +++ b/src/api/@types/User.ts @@ -1,14 +1,14 @@ // get -export interface GetUsersRequest { - // userId: number; -} - export interface GetUsersResponse { - userId: number; - username: string; - email: string; - thumbnail: string | null; - phone: string | null; - createDate: Date; - updateDate: Date; + code: number; + data: { + userId: number; + userName: string; + email: string; + thumbnail: string | null; + phone: string | null; + createDate: Date; + updateDate: Date; + }; + message: string | null; } diff --git a/src/api/axiosConfig.tsx b/src/api/axiosConfig.tsx index e8d84d7..27b7b2b 100644 --- a/src/api/axiosConfig.tsx +++ b/src/api/axiosConfig.tsx @@ -65,7 +65,7 @@ axiosInstance.interceptors.request.use( // 헤더에 토큰 추가 config.headers.Authorization = `Bearer ${authToken}`; - console.log('헤더에 토큰 추가 확인', config.headers.Authorization); + // console.log('헤더에 토큰 추가 확인', config.headers.Authorization); return config; } catch (err) { console.error('에러', err); diff --git a/src/components/RetroList/ContentsList.tsx b/src/components/RetroList/ContentsList.tsx index d13c4ee..650107f 100644 --- a/src/components/RetroList/ContentsList.tsx +++ b/src/components/RetroList/ContentsList.tsx @@ -8,15 +8,12 @@ import { IoMdPerson } from 'react-icons/io'; import { MdPeople } from 'react-icons/md'; import { RxCounterClockwiseClock } from 'react-icons/rx'; //before import { useNavigate } from 'react-router-dom'; -import { useRecoilState } from 'recoil'; import { PatchRetrospectiveRequest } from '@/api/@types/Retrospectives'; import postImageToS3 from '@/api/imageApi/postImageToS3'; import { patchRetrospective } from '@/api/retrospectivesApi/patchRetrospective'; import Thumbnail from '@/assets/Thumbnail.png'; import Modal from '@/components/RetroList/Modal'; -import UserNickname from '@/components/user/UserNickname'; import { useCustomToast } from '@/hooks/useCustomToast'; -import { userNicknameState } from '@/recoil/user/userAtom'; import * as S from '@/styles/RetroList/ContentsList.styles'; interface Content { @@ -31,6 +28,7 @@ interface Content { startDate: string; createdDate: string; updatedDate: string; + username: string; } interface ContentListProps { @@ -42,7 +40,6 @@ interface ContentListProps { const ContentList: React.FC = ({ data, viewMode, searchData, setBookmarkUpdate }) => { // const [contentData, setContentData] = useState(data); 받아온데이터 - const [userNickname, setUserNickname] = useRecoilState(userNicknameState); const [openModalId, setOpenModalId] = useState(null); const toast = useCustomToast(); const [image, setImage] = useState<{ [key: number]: string }>({}); @@ -73,6 +70,12 @@ const ContentList: React.FC = ({ data, viewMode, searchData, s console.log('filter', filteredData); const navigate = useNavigate(); + const convertToLocalTime = (dateString: string | number | Date) => { + const date = new Date(dateString); + const localTime = new Date(date.getTime() - date.getTimezoneOffset() * 60000); + return localTime.toLocaleString(); // 로컬 타임존으로 변환하여 문자열로 반환 + }; + useEffect(() => { const fetchThumbnailsData = async (item: Content) => { try { @@ -138,15 +141,13 @@ const ContentList: React.FC = ({ data, viewMode, searchData, s }} /> - - {/* 생성자 이름(유저 식별 필요) */} - {userNickname} - + {item.username}
- {item.updatedDate && item.updatedDate !== item.startDate - ? `${item.updatedDate} 수정` - : item.startDate} + {item.updatedDate !== item.createdDate + ? `${convertToLocalTime(item.updatedDate)} 수정` + : convertToLocalTime(item.createdDate)} + {/* {item.updatedDate !== item.createdDate ? `${item.updatedDate} 수정` : item.createdDate} */} {item.status === 'NOT_STARTED' && ( = ({ data, viewMode, searchData, s navigate(`/section?retrospectiveId=${item.id}&teamId=${item.teamId}`)}> {item.title} - - {/* 생성자이름(유저 식별 필요) */} - {userNickname} - + {item.username} {item.updatedDate && item.updatedDate !== item.startDate ? `${item.updatedDate}` : item.startDate} diff --git a/src/components/createRetro/modal/ImageUpload.tsx b/src/components/createRetro/modal/ImageUpload.tsx index c5fbdb2..f8eafa9 100644 --- a/src/components/createRetro/modal/ImageUpload.tsx +++ b/src/components/createRetro/modal/ImageUpload.tsx @@ -45,16 +45,21 @@ const ImageUpload: React.FC = ({ onChange }) => { - {/* 이미지 미리보기 */} - {imagePreview && ( -
- Selected Image - -
- )} +
+ {imagePreview && ( + +
+ Selected Image +
+
+ +
+
+ )} +
); diff --git a/src/pages/MyPage.tsx b/src/pages/MyPage.tsx index bc1561c..a552b96 100644 --- a/src/pages/MyPage.tsx +++ b/src/pages/MyPage.tsx @@ -56,7 +56,7 @@ const MyPage = () => { - {userData?.thumbnail} + {userData?.data.thumbnail} diff --git a/src/pages/RetroListPage.tsx b/src/pages/RetroListPage.tsx index f04808d..9dd30f6 100644 --- a/src/pages/RetroListPage.tsx +++ b/src/pages/RetroListPage.tsx @@ -83,6 +83,7 @@ const RetroListPage = () => { startDate: formatDate(item.startDate), createdDate: formatDate(item.createdDate), updatedDate: formatDate(item.updatedDate), + username: item.username, })); setRetroData(rawData); }, [data.nodes]); @@ -104,6 +105,7 @@ const RetroListPage = () => { startDate: formatDate(item.startDate), createdDate: formatDate(item.createdDate), updatedDate: formatDate(item.updatedDate), + username: item.username, })); setRetroData(filtered); } else if (filterType === 'Teams') { @@ -121,6 +123,7 @@ const RetroListPage = () => { startDate: formatDate(item.startDate), createdDate: formatDate(item.createdDate), updatedDate: formatDate(item.updatedDate), + username: item.username, })); setRetroData(filtered); } else if (filterType === 'ALL') { @@ -136,6 +139,7 @@ const RetroListPage = () => { startDate: formatDate(item.startDate), createdDate: formatDate(item.createdDate), updatedDate: formatDate(item.updatedDate), + username: item.username, })); setRetroData(rawData); }