From 7aac01750bdffc83ee6d25ed80f2bfb5335c36ad Mon Sep 17 00:00:00 2001 From: hyunwookchung Date: Thu, 12 Jan 2023 18:58:29 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EC=95=8C=EB=9E=8C=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=A1=B0=ED=9A=8CAPI=20=EC=9A=94=EC=B2=ADhook=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/user.ts | 4 ++++ apiHooks/user.ts | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api/user.ts b/api/user.ts index 7177370..8ec7ef5 100644 --- a/api/user.ts +++ b/api/user.ts @@ -22,3 +22,7 @@ export const getMySellInfo = async (isSaled: boolean) => { export const getMyInfo = async () => { return await userAPI.get(`/my/info?addressSplit=true`); }; + +export const getAlarm = async () => { + return await userAPI.get(`my/notifications`); +}; diff --git a/apiHooks/user.ts b/apiHooks/user.ts index 7b83774..69d6bb5 100644 --- a/apiHooks/user.ts +++ b/apiHooks/user.ts @@ -1,5 +1,5 @@ import { useQuery, useMutation } from '@tanstack/react-query'; -import { getmyBuy, getmyInfo, putmyInfo, getMySellInfo, getMyInfo } from 'api/user'; +import { getmyBuy, getmyInfo, putmyInfo, getMySellInfo, getMyInfo, getAlarm } from 'api/user'; import { MyInfoType } from 'types/recoil/myInfo'; export const useGetmyBuy = (isPurchased: boolean) => { @@ -41,3 +41,11 @@ export const useGetMyInfo = () => { }, }); }; + +export const useGetAlarm = () => { + return useQuery(['get/my/notifications'], () => getAlarm(), { + onError: (error) => { + console.log(error); + }, + }); +}; From c0c631eba9a27b62b9bd9d7bac38e198c2dfcd1b Mon Sep 17 00:00:00 2001 From: hyunwookchung Date: Thu, 12 Jan 2023 19:20:52 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=EC=84=9C=EB=B2=84=20GET=20API=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/my/{alram.tsx => alarm.tsx} | 42 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 16 deletions(-) rename pages/my/{alram.tsx => alarm.tsx} (66%) diff --git a/pages/my/alram.tsx b/pages/my/alarm.tsx similarity index 66% rename from pages/my/alram.tsx rename to pages/my/alarm.tsx index 8a305bb..acad43d 100644 --- a/pages/my/alram.tsx +++ b/pages/my/alarm.tsx @@ -4,31 +4,41 @@ import MainLogo from 'public/assets/icons/justpay_symbol_logo.svg'; import BuyIcon from 'public/assets/icons/notification_buy.svg'; import SellIcon from 'public/assets/icons/notification_sell.svg'; import React from 'react'; +import { useGetAlarm } from 'apiHooks/user'; export default function alram() { - const data = { - notificationType: '판매 알림', - message: '이런저런 메시지', - create: '2022.12.20 15:40', - }; + const { data: myAlarm } = useGetAlarm(); + + console.log(myAlarm); + const data = [ + { + notificationType: '판매 알림', + message: '이런저런 메시지', + create: '2022.12.20 15:40', + }, + ]; + return ( 중요한 거래 알림을 확인하세요! - - - - {data.notificationType === '구매 알림' ? : } - {data.notificationType} - - {data.create} - - {data.message} - - + {myAlarm?.data.data.map((item: { notificationType: string; createdAt: string; message: string }) => ( + + + + {item.notificationType === '구매 알림' ? : } + {item.notificationType} + + {item.createdAt} + + {item.message} + + ))} + + ); } From 5029858634d7c35caf9ef2bff6ade1bdc936de49 Mon Sep 17 00:00:00 2001 From: hyunwookchung Date: Thu, 12 Jan 2023 23:41:04 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20GNB=20=EB=A9=94=EB=89=B4=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/common/GNB.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/common/GNB.tsx b/components/common/GNB.tsx index 2989d1d..08606b4 100644 --- a/components/common/GNB.tsx +++ b/components/common/GNB.tsx @@ -11,19 +11,17 @@ import MyInfo from '../../public/assets/icons/myInfo.svg'; import MyInfoColor from '../../public/assets/icons/myInfo=color.svg'; import Router from 'next/router'; -interface GNBProps{ - currentGNB : string; +interface GNBProps { + currentGNB: string; } -export default function GNB({currentGNB} :GNBProps ) { - +export default function GNB({ currentGNB }: GNBProps) { const handleClickGNBOption = (e: React.MouseEvent) => { Router.push(`/my/${e.currentTarget.className}`); }; - return ( -