Skip to content

Commit

Permalink
Merge branch 'feat/notification' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Jun 7, 2024
2 parents 7549780 + 4a359c4 commit 93ecda6
Show file tree
Hide file tree
Showing 42 changed files with 808 additions and 202 deletions.
9 changes: 9 additions & 0 deletions public/NavLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/Notification-Check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions public/Notification_Warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added public/favicon1.ico
Binary file not shown.
Binary file added public/favicon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions public/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
Expand Down
9 changes: 9 additions & 0 deletions public/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 19 additions & 5 deletions src/api/auth/auth.patch.api.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -18,10 +20,22 @@ export const changepassword = async ({
};

export const memberimage = async (imageData: FormData) => {
const response = await patchRequest<ICommon<null>, 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);
}
};
32 changes: 32 additions & 0 deletions src/api/infitiequery/notice.get.api.ts
Original file line number Diff line number Diff line change
@@ -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<NotificationList>(url);
const lastVisible =
response?.data?.content[response?.data?.content.length - 1].notificationId;
return {
content: response?.data?.content,
lastVisible,
hasNext: response?.data?.hasNext
};
};
24 changes: 24 additions & 0 deletions src/api/mock.api.ts
Original file line number Diff line number Diff line change
@@ -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;
};
9 changes: 9 additions & 0 deletions src/api/question/question.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* 일대일 문의 전체 조회 */

import { getRequest } from '../request';
import { QuestionType } from '../types/question';

export const userinfo = async () => {
const response = await getRequest<QuestionType>('privatePosts');
return response;
};
16 changes: 16 additions & 0 deletions src/api/types/notification.ts
Original file line number Diff line number Diff line change
@@ -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<NotificationListType>;
20 changes: 20 additions & 0 deletions src/api/types/question.ts
Original file line number Diff line number Diff line change
@@ -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<QuestionPosttResponse & Message>;
5 changes: 3 additions & 2 deletions src/components/backarrow/BackArrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="h-[48px] flex flex-row justify-start items-center">
<Link href="/mypage">
<Link href={`/${link}`}>
<img
src="/mypage/passwordchange/BackArrow.svg"
alt="Back"
Expand Down
Loading

0 comments on commit 93ecda6

Please sign in to comment.