diff --git a/src/api/types/question.ts b/src/api/types/question.ts index 7ae4575..788d8b1 100644 --- a/src/api/types/question.ts +++ b/src/api/types/question.ts @@ -12,6 +12,10 @@ interface QuestionGet { content: string; branchName: string; createdDate: string; + answer: { + privatePostAnswerId: number; + content: string; + }; } interface QuestionGetResponse { diff --git a/src/components/modal/logoutModal/index.tsx b/src/components/modal/logoutModal/index.tsx index 1f05fa2..5405252 100644 --- a/src/components/modal/logoutModal/index.tsx +++ b/src/components/modal/logoutModal/index.tsx @@ -1,4 +1,5 @@ // components/LogoutModal.tsx +import { useSetMember } from '@/store/user'; import React from 'react'; interface LogoutModalProps { @@ -7,6 +8,7 @@ interface LogoutModalProps { } const LogoutModal = ({ onConfirm, onCancel }: LogoutModalProps) => { + const setmember = useSetMember(); return (
{
diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 167d6b8..197830c 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -6,7 +6,8 @@ import MainContainer from '@/components/shared/MainContainer'; import { useMember, useSetMember } from '@/store/user'; import React, { useEffect } from 'react'; import { useQuery } from 'react-query'; - +import { fcmpost } from '@/api/fcm/fcm.post.api'; +import { getTokenHandler } from '@/components/pwa/Fcm'; const Index = () => { /* eslint-disable */ const member = useMember(); @@ -16,6 +17,21 @@ const Index = () => { setmember(memberData?.data); }, [memberData, setmember]); + useEffect(() => { + const fetchToken = async () => { + try { + const token = await getTokenHandler(); + if (typeof token === 'string') { + fcmpost({ fcmToken: token }); + } + } catch (error) { + console.error('Failed to get FCM token:', error); + } + }; + + fetchToken(); + }, []); + return ( diff --git a/src/pages/mypage/question/index.tsx b/src/pages/mypage/question/index.tsx index 793408b..297ee51 100644 --- a/src/pages/mypage/question/index.tsx +++ b/src/pages/mypage/question/index.tsx @@ -118,10 +118,15 @@ const InquiryHistory = () => { {inquiriesData?.map( ( - data: { title: string; content: string; createdDate: string }, + data: { + title: string; + content: string; + createdDate: string; + answer: { content: string }; + }, index: number ) => { - const openAnswer = inquiriesData.length - index; + // const openAnswer = inquiriesData.length - index; return (
{
- -
-
-
- {openAnswer} + {data.answer && ( +
+
+
+ {data.answer.content} +
+
-
-
+ )}
)}
diff --git a/src/pages/sign/index.tsx b/src/pages/sign/index.tsx index 7725e39..1d507e3 100644 --- a/src/pages/sign/index.tsx +++ b/src/pages/sign/index.tsx @@ -5,10 +5,10 @@ import SignUpButton from '@/components/shared/sign/SignUpButton'; import Link from 'next/link'; // import useSendPush from '@/components/pwa/UseSendPush'; -import { getTokenHandler } from '@/components/pwa/Fcm'; import { useEffect, useState } from 'react'; import { useRouter } from 'next/navigation'; import { getCookie } from '@/utils/cookies'; +import { getTokenHandler } from '@/components/pwa/Fcm'; const SignHomePage = () => { const token = getCookie('token');