From 77e7a5bd4fa9ac73922f9c0b775b9e59b41a0208 Mon Sep 17 00:00:00 2001
From: oaoong
Date: Tue, 28 Nov 2023 18:14:10 +0900
Subject: [PATCH 01/15] =?UTF-8?q?:bug:=20=ED=86=A0=ED=81=B0=20=EA=B4=80?=
=?UTF-8?q?=EB=A6=AC=20=EC=9E=AC=EC=A0=95=EC=9D=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/hooks/useValidate.ts | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/hooks/useValidate.ts b/src/hooks/useValidate.ts
index 3e30613e..09c59c9f 100644
--- a/src/hooks/useValidate.ts
+++ b/src/hooks/useValidate.ts
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import Cookies from 'js-cookie'
import { usePathname, useRouter } from 'next/navigation'
+import AppPath from '@/config/appPath'
import { Environment } from '@/config/environment'
import apiClient from '@/services/apiClient'
import { getValidateUser } from '@/services/auth/auth'
@@ -26,27 +27,28 @@ const useValidate = () => {
const res = await getValidateUser()
return res
},
+ retry: 3,
enabled: !!token,
})
useEffect(() => {
if (isError) {
- // Cookies.remove(Environment.tokenName())
- // setIsLoggedIn(() => false)
- // setCurrentUser(() => null)
- // router.push(AppPath.login(), { scroll: false })
- // toast({
- // title: '인증 에러',
- // description: '인증에 실패하였습니다. 다시 시도하거나 로그인해주세요.',
- // variant: 'destructive',
- // duration: 3000,
- // })
+ Cookies.remove(Environment.tokenName())
+ setIsLoggedIn(() => false)
+ setCurrentUser(() => null)
+ router.push(AppPath.login(), { scroll: false })
+ toast({
+ title: '인증 에러',
+ description: '인증에 실패하였습니다. 다시 시도하거나 로그인해주세요.',
+ variant: 'destructive',
+ duration: 3000,
+ })
}
if (data) {
setIsLoggedIn(() => true)
setCurrentUser(() => data?.data?.userInfo)
}
- }, [currentUser, data, isError, isLoggedIn, pathname, router, token])
+ }, [currentUser, data, isError, isLoggedIn, pathname, router, toast, token])
return { isLoggedIn, currentUser }
}
From bbe027817ebe005e7f6f7b49dce7deb161e2be91 Mon Sep 17 00:00:00 2001
From: oaoong
Date: Tue, 28 Nov 2023 22:27:39 +0900
Subject: [PATCH 02/15] =?UTF-8?q?:sparkles:=20=EB=A7=88=EC=9D=B4=EB=84=88?=
=?UTF-8?q?=ED=95=9C=20css=20=EC=88=98=EC=A0=95=EC=82=AC=ED=95=AD=20?=
=?UTF-8?q?=EB=B0=98=EC=98=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../(routes)/cards/[cardId]/modify/CardModifyTemplate.tsx | 2 +-
.../chatrooms/[chatRoomId]/components/ChatInput.tsx | 5 ++---
.../[chatRoomId]/components/CompleteRequestButton.tsx | 2 +-
src/app/layout.tsx | 3 ++-
src/components/domain/logo/Logo.tsx | 7 ++++++-
tailwind.config.js | 4 ++++
6 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/app/(root)/(routes)/cards/[cardId]/modify/CardModifyTemplate.tsx b/src/app/(root)/(routes)/cards/[cardId]/modify/CardModifyTemplate.tsx
index 4fc8f57a..ea8da4ab 100644
--- a/src/app/(root)/(routes)/cards/[cardId]/modify/CardModifyTemplate.tsx
+++ b/src/app/(root)/(routes)/cards/[cardId]/modify/CardModifyTemplate.tsx
@@ -68,7 +68,7 @@ const CardModifyTemplate = ({ cardInfo, cardId }: CardModifyTemplateProps) => {
variant={'gradation'}
disabled={isSubmitting}
>
- 등록하기
+ 수정하기
diff --git a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatInput.tsx b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatInput.tsx
index fd52c0df..a9594a98 100644
--- a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatInput.tsx
+++ b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatInput.tsx
@@ -27,15 +27,14 @@ const ChatInput = ({
return (
{formatDistanceToNow(new Date(createdAt), {
diff --git a/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx b/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx
index 192b496b..9e1b5cfb 100644
--- a/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx
+++ b/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx
@@ -1,4 +1,6 @@
+import { Suspense } from 'react'
import { useRouter } from 'next/navigation'
+import Loading from '@/app/loading'
import SuggestCard from '@/components/domain/card/suggest-card'
import NoData from '@/components/domain/no-data'
import { Tabs, TabsTrigger, TabsList, TabsContent } from '@/components/ui/tabs'
@@ -51,19 +53,21 @@ const SuggestList = ({ pokeAvailable, toCardId }: SuggestListProps) => {
오퍼하기
찔러보기
- {['OFFER', 'POKE'].map((type) => (
-
- {!pokeAvailable && type === 'POKE' ? (
-
- ) : (
- filterData(type)
- )}
-
- ))}
+ }>
+ {['OFFER', 'POKE'].map((type) => (
+
+ {!pokeAvailable && type === 'POKE' ? (
+
+ ) : (
+ filterData(type)
+ )}
+
+ ))}
+
)
}
diff --git a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx
new file mode 100644
index 00000000..29a08a58
--- /dev/null
+++ b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx
@@ -0,0 +1,25 @@
+'use client'
+
+import Lottie from 'react-lottie-player'
+import lottieJson from '../../../../../../public/loading.json'
+
+const Loading = () => {
+ return (
+
+ )
+}
+
+export default Loading
diff --git a/src/app/(root)/(routes)/notifications/components/notification-card/NotificationCard.tsx b/src/app/(root)/(routes)/notifications/components/notification-card/NotificationCard.tsx
index 0ac4ead8..861d5411 100644
--- a/src/app/(root)/(routes)/notifications/components/notification-card/NotificationCard.tsx
+++ b/src/app/(root)/(routes)/notifications/components/notification-card/NotificationCard.tsx
@@ -14,9 +14,13 @@ const NotificationCard = ({
}: NotificationCardProps) => {
const router = useRouter()
const { mutate } = useNotificationUpdateMutation()
+ const isCompleteRequestNotification = content.includes('성사')
+
const handleReadNotification = async () => {
if (!read) {
mutate({ notificationId, cardId })
+ } else if (isCompleteRequestNotification) {
+ router.push(AppPath.chatRooms())
} else {
router.push(AppPath.mySuggestions(cardId))
}
diff --git a/src/app/loading.tsx b/src/app/loading.tsx
index 37426efe..a1c7446a 100644
--- a/src/app/loading.tsx
+++ b/src/app/loading.tsx
@@ -5,7 +5,7 @@ import lottieJson from '../../public/loading.json'
const Loading = () => {
return (
-
+
{
const { mutate } = useSuggestionCreateMutation(toCardId, fromCardId)
-
+ const router = useRouter()
const onClickSuggest = async (suggestionType: SuggestionType) => {
mutate({ suggestionType, fromCardId, toCardId })
}
@@ -44,12 +46,13 @@ const SuggestCard = ({
gap={'space'}
className="h-full"
>
-
+
router.push(AppPath.card(String(fromCardId)))}
/>
diff --git a/src/hooks/useDibs.ts b/src/hooks/useDibs.ts
index 3d0004eb..ab8c1e69 100644
--- a/src/hooks/useDibs.ts
+++ b/src/hooks/useDibs.ts
@@ -1,10 +1,15 @@
'use client'
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
import { deleteCardDibs, postCardDibs } from '@/services/card/card'
import { toast } from './useToast'
const useDibs = (isMyDib: boolean, count: number) => {
+ useEffect(() => {
+ setIsDibsActive(isMyDib)
+ setDibsCount(count)
+ }, [count, isMyDib])
+
const [isDibsActive, setIsDibsActive] = useState(isMyDib)
const [dibsCount, setDibsCount] = useState(count)