diff --git a/public/NavLogo.svg b/public/NavLogo.svg new file mode 100644 index 0000000..3ee063e --- /dev/null +++ b/public/NavLogo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/Notification-Check.svg b/public/Notification-Check.svg new file mode 100644 index 0000000..4da8df0 --- /dev/null +++ b/public/Notification-Check.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/public/Notification_Warning.svg b/public/Notification_Warning.svg new file mode 100644 index 0000000..d5079b1 --- /dev/null +++ b/public/Notification_Warning.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/public/Resoulvation.svg b/public/Reservation.svg similarity index 100% rename from public/Resoulvation.svg rename to public/Reservation.svg diff --git a/public/favicon1.ico b/public/favicon1.ico new file mode 100644 index 0000000..3bc7629 Binary files /dev/null and b/public/favicon1.ico differ diff --git a/public/favicon16.png b/public/favicon16.png new file mode 100644 index 0000000..c92d0e0 Binary files /dev/null and b/public/favicon16.png differ diff --git a/public/favicon32.png b/public/favicon32.png new file mode 100644 index 0000000..cff04c7 Binary files /dev/null and b/public/favicon32.png differ diff --git a/public/firebase-messaging-sw.js b/public/firebase-messaging-sw.js index 4a85b11..4d16757 100644 --- a/public/firebase-messaging-sw.js +++ b/public/firebase-messaging-sw.js @@ -13,9 +13,6 @@ firebase.initializeApp({ // 푸시 내용을 처리해서 알림으로 띄운다. self.addEventListener('push', function (event) { if (event.data) { - console.log(event.data.json().data); - console.log(event.data.json().notification); - // 알림 메세지일 경우엔 event.data.json().notification; const url = event.data.json().data; const data = event.data.json().notification; @@ -38,13 +35,9 @@ self.addEventListener('push', function (event) { // 알림을 클릭하면 사이트로 이동한다. self.addEventListener('notificationclick', function (event) { event.preventDefault(); - // 알림창 닫기 event.notification.close(); - - // 이동할 url const urlToOpen = event.notification.data.targetUrl; - console.log(urlToOpen); - // 클라이언트에 해당 사이트가 열려 있는지 체크 + const promiseChain = clients .matchAll({ type: 'window', diff --git a/public/test.jpg b/public/test.jpg new file mode 100644 index 0000000..76efa80 --- /dev/null +++ b/public/test.jpg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/api/auth/auth.patch.api.ts b/src/api/auth/auth.patch.api.ts index 34bfbed..2336acb 100644 --- a/src/api/auth/auth.patch.api.ts +++ b/src/api/auth/auth.patch.api.ts @@ -1,9 +1,11 @@ /* 비밀번호 재설정 */ // const a = 0; +import axios from 'axios'; import { patchRequest } from '../request'; import { IPasswordChage } from '../types/auth'; import { ICommon } from '../types/common'; +import { getCookie } from '@/utils/cookies'; export const changepassword = async ({ currentPassword, @@ -18,10 +20,22 @@ export const changepassword = async ({ }; export const memberimage = async (imageData: FormData) => { - const response = await patchRequest, FormData>( - 'members/image', - imageData - ); + const token = getCookie('token'); + try { + const response = await axios.patch( + `${process.env.NEXT_PUBLIC_BASE_URL}members/image`, + imageData, + { + headers: { + 'Content-Type': 'multipart/form-data', + Authorization: `Bearer ${token}` + }, + withCredentials: true + } + ); - return response; + return response; + } catch (e) { + console.log(e); + } }; diff --git a/src/api/infitiequery/notice.get.api.ts b/src/api/infitiequery/notice.get.api.ts new file mode 100644 index 0000000..ae72a25 --- /dev/null +++ b/src/api/infitiequery/notice.get.api.ts @@ -0,0 +1,32 @@ +// import { ICommon } from '../types/common'; +import { getRequest } from '../request'; +import { NotificationList } from '../types/notification'; + +/* 알림 조회*/ + +export const noticeInfo = async (type: string, cursorId?: string) => { + let url = `notification`; + const params = []; + + if (type && type === 'RESERVATION') { + params.push(`type=RESERVATION`); + } else if (type && type === 'COMMUNITY') { + params.push(`type=COMMUNITY`); + } + + if (cursorId !== '0') { + params.push(`cursorId=${cursorId}`); + } + + if (params.length > 0) { + url += `?${params.join('&')}`; + } + const response = await getRequest(url); + const lastVisible = + response?.data?.content[response?.data?.content.length - 1].notificationId; + return { + content: response?.data?.content, + lastVisible, + hasNext: response?.data?.hasNext + }; +}; diff --git a/src/api/mock.api.ts b/src/api/mock.api.ts index 3657c76..8df8390 100644 --- a/src/api/mock.api.ts +++ b/src/api/mock.api.ts @@ -1,6 +1,30 @@ import axios from 'axios'; +interface IQuestion { + title: string; + content: string; +} export const signinmock = async () => { const response = await axios.get(`/sign`); return response; }; + +export const questionpostmock = async ({ title, content }: IQuestion) => { + const response = await axios.post(`/question`, { title, content }); + return response; +}; + +export const questiongetmock = async () => { + const response = await axios.get(`/question`); + return response; +}; + +export const reservationgetmock = async () => { + const response = await axios.get(`/notification/reservation`); + return response; +}; + +export const communitygetmock = async () => { + const response = await axios.get(`/notification/community`); + return response; +}; diff --git a/src/api/question/question.api.ts b/src/api/question/question.api.ts new file mode 100644 index 0000000..b63e68b --- /dev/null +++ b/src/api/question/question.api.ts @@ -0,0 +1,9 @@ +/* 일대일 문의 전체 조회 */ + +import { getRequest } from '../request'; +import { QuestionType } from '../types/question'; + +export const userinfo = async () => { + const response = await getRequest('privatePosts'); + return response; +}; diff --git a/src/api/types/notification.ts b/src/api/types/notification.ts new file mode 100644 index 0000000..3316ce7 --- /dev/null +++ b/src/api/types/notification.ts @@ -0,0 +1,16 @@ +import { ICommon } from './common'; + +export interface NotificationType { + notificationId: string; + title: string; + content: string; + targetUrl: string; + date: string; +} + +interface NotificationListType { + content: NotificationType[]; + hasNext: boolean; +} + +export type NotificationList = ICommon; diff --git a/src/api/types/question.ts b/src/api/types/question.ts new file mode 100644 index 0000000..3d900cc --- /dev/null +++ b/src/api/types/question.ts @@ -0,0 +1,20 @@ +import { ICommon } from './common'; + +interface QuestionPost { + id: number; + title: string; + content: string; + branchName: string; + createdDate: string; +} + +interface QuestionPosttResponse { + privatePostList: QuestionPost[]; + hasNext: boolean; +} + +interface Message { + message: string; +} + +export type QuestionType = ICommon; diff --git a/src/components/backarrow/BackArrow.tsx b/src/components/backarrow/BackArrow.tsx index b74b2de..56e3009 100644 --- a/src/components/backarrow/BackArrow.tsx +++ b/src/components/backarrow/BackArrow.tsx @@ -4,11 +4,12 @@ interface BackArrowProps { width: string; height: string; name?: string; + link: string; } -export const BackArrow = ({ width, height, name }: BackArrowProps) => { +export const BackArrow = ({ width, height, name, link }: BackArrowProps) => { return (
- + Back { + // const router = useRouter(); + + const ref = useRef(null); + const pageRef = useIntersectionObserver(ref, {}); + const isPageEnd = !!pageRef?.isIntersecting; + console.log(isPageEnd); + const { + data, + fetchNextPage, + isFetching, + hasNextPage = false, + isFetchingNextPage + } = useInfiniteQuery({ + queryKey: ['notice', sortType], + queryFn: ({ pageParam }) => { + return noticeInfo(sortType, pageParam); + }, + getNextPageParam: (lastPage) => { + return lastPage.hasNext ? lastPage.lastVisible : undefined; + }, + + initialPageParam: '0' + }); + + const fetchNext = useCallback(async () => { + const res = await fetchNextPage(); + if (res.isError) { + console.log(res.error); + } + }, [fetchNextPage]); + + useEffect(() => { + let timerId: NodeJS.Timeout | undefined; + + if (isPageEnd && hasNextPage) { + timerId = setTimeout(() => { + fetchNext(); + }, 1000); + } + + return () => clearTimeout(timerId); + }, [fetchNext, isPageEnd, hasNextPage]); + + const allPosts = data?.pages?.map(({ content }) => content).flat(); + + return { + allPosts, + isFetching, + isFetchingNextPage, + hasNextPage, + ref + }; +}; + +export default useNoticeGet; diff --git a/src/components/footer/Footer.tsx b/src/components/footer/Footer.tsx index a8c96c3..c5ad177 100644 --- a/src/components/footer/Footer.tsx +++ b/src/components/footer/Footer.tsx @@ -16,9 +16,9 @@ const Footer = () => { return (