From 22b4318937d560152010020794ba51faf053ba90 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 15:58:39 +0900 Subject: [PATCH 01/14] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=EB=82=98?= =?UTF-8?q?=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EB=AC=B4=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=ED=98=84=EC=83=81=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/client.ts | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/src/apis/client.ts b/src/apis/client.ts index 2564af2..3c83d48 100644 --- a/src/apis/client.ts +++ b/src/apis/client.ts @@ -9,27 +9,7 @@ const client = axios.create({ headers: { 'Content-Type': 'application/json' }, }); -// type FailedRequest = { -// resolve: (token: string) => void; -// reject: (error: unknown) => void; -// }; - let isRefreshing = false; -// let failedQueue: FailedRequest[] = []; - -// const processQueue = (error: unknown, token: string | null = null) => { -// failedQueue.forEach((prom) => { -// if (error) { -// prom.reject(error); -// } else { -// if (token) { -// prom.resolve(token); -// } -// } -// }); - -// failedQueue = []; -// }; const callReissue = async () => { try { @@ -72,19 +52,6 @@ client.interceptors.response.use( retry = true; if (isRefreshing) { if (isLoggedIn) logout(); - // try { - // return new Promise((resolve, reject) => { - // failedQueue.push({ - // resolve: (token: string) => { - // originalRequest.headers.Authorization = `Bearer ${token}`; - // resolve(client(originalRequest)); - // }, - // reject: (err: unknown) => reject(err), - // }); - // }); - // } catch (e) { - // return Promise.reject(e); - // } } else { isRefreshing = true; try { @@ -102,8 +69,6 @@ client.interceptors.response.use( } } } - // if (isLoggedIn) logout(); - // console.error('Failed to refresh token', error); return Promise.reject(error); }, ); From e2a5a550fc8f8d991be80935e9fd0fd3703558c3 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 15:59:25 +0900 Subject: [PATCH 02/14] =?UTF-8?q?fix:=20client.ts=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/client.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/apis/client.ts b/src/apis/client.ts index 3c83d48..663d2c1 100644 --- a/src/apis/client.ts +++ b/src/apis/client.ts @@ -57,12 +57,10 @@ client.interceptors.response.use( try { const newToken = await callReissue(); setAccessToken(newToken); - // processQueue(null, newToken); isRefreshing = false; originalRequest.headers.Authorization = `Bearer ${newToken}`; return client(originalRequest); } catch (e) { - // processQueue(e, null); isRefreshing = false; if (isLoggedIn) logout(); return Promise.reject(e); From 63f91c08f539c3e5869e82aaefbe5ab04c63f44c Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 16:05:25 +0900 Subject: [PATCH 03/14] =?UTF-8?q?fix:=20=ED=83=88=ED=87=B4=EC=8B=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyPage/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 2ed0b5c..4fed13c 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -28,7 +28,7 @@ const MyPage = () => { try { const response = await deleteUserInfo(); if (!response) throw new Error('deletioning failed'); - console.log(response); + return response; } catch (error) { console.error(error); } @@ -43,9 +43,12 @@ const MyPage = () => { cancelText="되돌아가기" confirmText="탈퇴하기" onCancel={() => setIsOpenModal(false)} - onConfirm={() => { - handleLeave(); + onConfirm={async () => { + const response = await handleLeave(); setIsOpenModal(false); + if (response?.status === 200) { + logout(); + } }} /> )} From d3ebe3ae92b17a749d59f66ab912fa72eba49ee7 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 16:20:48 +0900 Subject: [PATCH 04/14] =?UTF-8?q?feat:=20=ED=83=88=ED=87=B4=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EC=8B=9C=20alert=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyPage/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 4fed13c..183a5aa 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -31,6 +31,7 @@ const MyPage = () => { return response; } catch (error) { console.error(error); + alert('서버 오류로 인해 탈퇴 처리가 되지 않았습니다. 다음에 다시 시도해주세요.'); } }; @@ -48,6 +49,7 @@ const MyPage = () => { setIsOpenModal(false); if (response?.status === 200) { logout(); + alert('탈퇴 되었습니다.'); } }} /> From cde233797fd72a6dc0658952b127ec92d3681582 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 16:29:57 +0900 Subject: [PATCH 05/14] =?UTF-8?q?fix:=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80,=20=EB=82=B4=20=EA=B3=B5=EC=9C=A0=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EB=AC=BC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=EB=95=8C=20=EC=9E=90=EC=9E=98=ED=95=9C=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/LetterBoard/index.tsx | 40 ++++++++++++--------- src/pages/MyPage/components/MyBoardPage.tsx | 7 ++-- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/pages/LetterBoard/index.tsx b/src/pages/LetterBoard/index.tsx index a3e26ab..bcd26f1 100644 --- a/src/pages/LetterBoard/index.tsx +++ b/src/pages/LetterBoard/index.tsx @@ -41,7 +41,7 @@ const LetterBoardPage = () => { gcTime: 1000 * 60 * 10, }); - const postLists = data?.pages.flatMap((page) => page?.content) || []; + const postLists = data?.pages?.flatMap((page) => page?.content || []) || []; useEffect(() => { if (!hasNextPage) return; @@ -66,23 +66,29 @@ const LetterBoardPage = () => { {isLoading ? (

loading

- ) : postLists && postLists?.length > 0 ? ( -
- {postLists?.map((item, index) => { - return ( - - ); - })} -
+ ) : postLists ? ( + postLists?.length > 0 ? ( +
+ {postLists?.map((item, index) => { + return ( + + ); + })} +
+ ) : ( +

게시글이 없습니다.

+ ) ) : ( -

게시글이 없습니다.

+

+ 오류가 발생했습니다. 다시 한 번 시도해주세요 +

)} diff --git a/src/pages/MyPage/components/MyBoardPage.tsx b/src/pages/MyPage/components/MyBoardPage.tsx index d55cc9b..a4c3759 100644 --- a/src/pages/MyPage/components/MyBoardPage.tsx +++ b/src/pages/MyPage/components/MyBoardPage.tsx @@ -14,11 +14,14 @@ const MyBoardPage = () => { const fetchMyPostList = async () => { try { const response = await getMySharePostList(); - if (!response) throw new Error('게시글 목록을 불러오는데 실패했습니다.'); + if (!response) { + throw new Error('게시글 목록을 불러오는데 실패했습니다.'); + } console.log('myPostList', response); return response.data as SharePost[]; } catch (e) { console.error(e); + return []; } }; @@ -42,7 +45,7 @@ const MyBoardPage = () => {
내가 올린 게시물 {isLoading ? ( -

loading

+

로딩 중 입니다.

) : postLists && postLists?.length > 0 ? (
{postLists?.map((item, index) => ( From 4e9bd1c11c3a2264f0952b97989a747160c4da07 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 20:39:29 +0900 Subject: [PATCH 06/14] =?UTF-8?q?fix:=20=ED=8E=B8=EC=B9=98=20=EC=BF=BC?= =?UTF-8?q?=EB=A6=AC=20=EA=B0=B1=EC=8B=A0=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20-=20queryClient.invalidateQueries=EB=A1=9C=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=EB=A5=BC=20=EA=B0=B1=EC=8B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/LetterBox/index.tsx | 2 +- src/pages/LetterBoxDetail/index.tsx | 4 +++- src/pages/LetterDetail/index.tsx | 15 ++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pages/LetterBox/index.tsx b/src/pages/LetterBox/index.tsx index c8010c9..5f173f1 100644 --- a/src/pages/LetterBox/index.tsx +++ b/src/pages/LetterBox/index.tsx @@ -32,7 +32,7 @@ const LetterBoxPage = () => { isLoading, isError, } = useQuery({ - queryKey: ['mailbox'], + queryKey: ['mailBox'], queryFn: fetchMailLists, staleTime: 1000 * 60 * 5, gcTime: 1000 * 60 * 10, diff --git a/src/pages/LetterBoxDetail/index.tsx b/src/pages/LetterBoxDetail/index.tsx index 262cc03..8b2781c 100644 --- a/src/pages/LetterBoxDetail/index.tsx +++ b/src/pages/LetterBoxDetail/index.tsx @@ -1,4 +1,4 @@ -import { useMutation, useInfiniteQuery } from '@tanstack/react-query'; +import { useMutation, useInfiniteQuery, useQueryClient } from '@tanstack/react-query'; import { ChangeEvent, useEffect, useState } from 'react'; import { useInView } from 'react-intersection-observer'; import { useLocation, useNavigate } from 'react-router'; @@ -28,6 +28,7 @@ const LetterBoxDetailPage = () => { const [isOpenShareModal, setIsOpenShareModal] = useState(false); const [selected, setSelected] = useState([]); const [shareComment, setShareComment] = useState(''); + const queryClient = useQueryClient(); const navigate = useNavigate(); @@ -63,6 +64,7 @@ const LetterBoxDetailPage = () => { mutationFn: async () => await postMailboxDisconnect(userInfo.id), onSuccess: () => { navigate(-1); + queryClient.invalidateQueries({ queryKey: ['mailBox'] }); }, onError: (error) => { // TODO: 차단 실패 toastUI 띄워주기 diff --git a/src/pages/LetterDetail/index.tsx b/src/pages/LetterDetail/index.tsx index 86cf44f..7953564 100644 --- a/src/pages/LetterDetail/index.tsx +++ b/src/pages/LetterDetail/index.tsx @@ -22,14 +22,16 @@ const LetterDetailPage = () => { const [reportModalOpen, setReportModalOpen] = useState(false); const [deleteModalOpen, setDeleteModalOpen] = useState(false); - const handleDeleteLetter = async (letterId: string) => { - const res = await deleteLetter(letterId); - if (res?.status === 200) { + const { mutate: handleDeleteLetter } = useMutation({ + mutationFn: (letterId: string) => deleteLetter(letterId), + onSuccess: () => { navigate(-1); - } else { + queryClient.invalidateQueries({ queryKey: ['mailBoxDetail'] }); + }, + onError: () => { alert('편지 삭제 도중 오류 발생(임시)'); - } - }; + }, + }); useEffect(() => { const handleGetLetter = async (letterId: string) => { @@ -86,7 +88,6 @@ const LetterDetailPage = () => { }} onConfirm={() => { if (params.id) handleDeleteLetter(params.id); - navigate(-1); }} /> )} From f90d9aa4f15a96d4b90bf496f2b60d747b9c8735 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Fri, 7 Mar 2025 20:40:57 +0900 Subject: [PATCH 07/14] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=EC=8B=9C=20aler?= =?UTF-8?q?t=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/LetterBoxDetail/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/LetterBoxDetail/index.tsx b/src/pages/LetterBoxDetail/index.tsx index 8b2781c..8447a8d 100644 --- a/src/pages/LetterBoxDetail/index.tsx +++ b/src/pages/LetterBoxDetail/index.tsx @@ -67,8 +67,7 @@ const LetterBoxDetailPage = () => { queryClient.invalidateQueries({ queryKey: ['mailBox'] }); }, onError: (error) => { - // TODO: 차단 실패 toastUI 띄워주기 - // 요청이 실패했어요 잠시 후에 다시 시도해주세요. + alert('편지 연결 해제에 실패했습니다.'); console.error(error); }, }); @@ -80,8 +79,8 @@ const LetterBoxDetailPage = () => { setShareComment(''); }, onError: (error) => { - // TODO: 차단 실패 toastUI 띄워주기 - // 요청이 실패했어요 잠시 후에 다시 시도해주세요. + alert('편지 공유에 실패했습니다.'); + console.error(error); }, }); From f041b15dcde3f52e818b91ab5140903c0a58ed43 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Sun, 9 Mar 2025 19:02:41 +0900 Subject: [PATCH 08/14] =?UTF-8?q?fix:=20=ED=83=88=ED=87=B4=ED=95=9C=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80,?= =?UTF-8?q?=20=EC=98=A8=EB=B3=B4=EB=94=A9=20from=20=EC=99=BC=EC=AA=BD=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Auth/index.tsx | 6 ++++++ src/pages/Onboarding/WelcomeLetter.tsx | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/Auth/index.tsx b/src/pages/Auth/index.tsx index 0596a77..cd892d5 100644 --- a/src/pages/Auth/index.tsx +++ b/src/pages/Auth/index.tsx @@ -7,6 +7,7 @@ import useAuthStore from '@/stores/authStore'; const AuthCallbackPage = () => { const stateToken = new URLSearchParams(window.location.search).get('state'); const redirectURL = new URLSearchParams(window.location.search).get('redirect'); + const error = new URLSearchParams(window.location.search).get('error'); const login = useAuthStore((state) => state.login); const logout = useAuthStore((state) => state.logout); @@ -32,6 +33,8 @@ const AuthCallbackPage = () => { login(); if (userInfo.accessToken) setAccessToken(userInfo.accessToken); + console.log(redirectURL); + switch (redirectURL) { case 'home': { @@ -67,6 +70,9 @@ const AuthCallbackPage = () => { useEffect(() => { if (!stateToken) { navigate('/notFound'); + if (error === 'deleted_member') { + alert('탈퇴한 회원입니다.'); + } return; } diff --git a/src/pages/Onboarding/WelcomeLetter.tsx b/src/pages/Onboarding/WelcomeLetter.tsx index 50b7e4e..49a1716 100644 --- a/src/pages/Onboarding/WelcomeLetter.tsx +++ b/src/pages/Onboarding/WelcomeLetter.tsx @@ -5,7 +5,7 @@ export default function index() { const navigate = useNavigate(); return (
-
+

To.따숨이

환영합니다! 우리 함께 마음을 나누어 보아요

@@ -22,7 +22,7 @@ export default function index() {

3. 고민 편지에 대한 답장은 검수 후에 전달됩니다.

-

From.9황작물

+

From.9황작물