Skip to content

Commit

Permalink
fix: test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Jun 11, 2024
1 parent ce1f5ad commit a571488
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 12 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"framer-motion": "^11.1.9",
"haversine": "^1.1.1",
"idb": "^8.0.0",
"lodash": "^4.17.21",
"next": "14.2.3",
"next-pwa": "^5.6.0",
"react": "^18",
Expand All @@ -37,6 +38,7 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
"@types/lodash": "^4.17.5",
"@types/navermaps": "^3.7.5",
"@types/node": "^20",
"@types/react": "^18",
Expand Down
5 changes: 1 addition & 4 deletions public/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ self.addEventListener('notificationclick', async function (event) {
tx.store.put(val, key);
await tx.done;
}
event.waitUntil(
// 'targetId'라는 키로 event.notification.data.targetId 값을 저장합니다.
set('targetId', event.notification.data.targetId)
);
event.waitUntil(set('targetId', event.notification.data.targetId));

// 클라이언트에 해당 사이트가 열려 있는지 체크
const promiseChain = clients
Expand Down
5 changes: 3 additions & 2 deletions src/api/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import logOnDev from '@utils/logOnDev';
// import jwtDecode from 'jwt-decode';
import { updateRefresh } from './refresh/tokenRefresh.api';

import { UseRouter } from '@/hook/UseRouter';
// import { UseRouter } from '@/hook/UseRouter';

export const instance: Axios = axios.create({
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
Expand Down Expand Up @@ -75,7 +75,8 @@ instance.interceptors.response.use(
}
} catch (refreshError) {
removeCookie('refreshToken');
UseRouter('');

// window.location.href = '/';
return Promise.reject(refreshError);
}
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/components/modal/logoutModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// components/LogoutModal.tsx
import { useSetMember } from '@/store/user';
import { removeCookie } from '@/utils/cookies';
import React from 'react';

interface LogoutModalProps {
Expand All @@ -25,6 +26,7 @@ const LogoutModal = ({ onConfirm, onCancel }: LogoutModalProps) => {
className="h-[42px] flex-1 text-center font-bold text-indigo-700 leading-normal text-lg font-['Pretendard']"
onClick={() => {
onConfirm();
removeCookie('token');
setmember({
memberEmail: '',
memberName: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ const MeetingDetailModal = () => {
// }
// }, [data]);

// if (data == undefined) {
// return null;
// }
if (data == undefined) {
return null;
}

const date =
data && data.startAt
Expand Down
2 changes: 2 additions & 0 deletions src/components/reservation/remote/myreservation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export const getReservationDetail = async (reservationId: number | null) => {
const { data } = await getRequest<ReservationDetail>(`reservations/${reservationId}`);
return data as reservationDetailData;
} catch (error: any) {
alert('이미 종료된 일정입니다');
window.location.href = '/';
return error.response.data;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/hook/useLoggedOut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ function useLoggedOut() {
const query = useQueryClient();

const logout = (redirectPath = '/sign') => {
router.push(redirectPath);
removeCookie('token');
router.push(redirectPath);
query.clear();
};

Expand Down
5 changes: 4 additions & 1 deletion src/hook/useLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { setCookie } from '@/utils/cookies';
import { useRouter } from 'next/navigation';
import { useMutation } from '@tanstack/react-query';
import { useState } from 'react';
import { throttle } from 'lodash';
//todo 기범님 오류
// import { getTokenHandler } from '@/components/pwa/Fcm';
// import { fcmpost } from '@/api/fcm/fcm.post.api';
Expand All @@ -26,11 +27,13 @@ const useLogin = () => {
console.log(error);
};

const { mutate } = useMutation({
const { mutate: originalMutate } = useMutation({
mutationFn: signin,
onSuccess,
onError
});

const mutate = throttle(originalMutate, 3000); // 3초 동안 throttle 처리
return { mutate, error };
};

Expand Down
2 changes: 2 additions & 0 deletions src/pages/mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ const MyPage = () => {
console.log('Logged out');
setModalVisible(false);
setSuccessModal(true);

setTimeout(() => {
logout();
}, 2000);
};

useUpdateMember();
const handleCancel = () => {
setModalVisible(false);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/mypage/question/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const InquiryForm = () => {
setTitle('');
setContent('');
alert('문의등록이 완료되었습니다!');
window.location.reload();
} catch {
alert('문의등록에 실패했습니다.');
}
Expand All @@ -43,7 +44,7 @@ const InquiryForm = () => {
return (
<div className="w-full overflow-y-auto h-full max-w-md mx-auto p-4">
<div
className="w-[140px] flex flex-row items-center mb-4 cursor-pointer"
className="w-[180px] flex flex-row items-center mb-4 cursor-pointer"
onClick={handleSearchClick}>
<img className=" w-5 h-5" src="/mypage/inquiry/Map.svg" alt="map" />
{/* api */}
Expand Down

0 comments on commit a571488

Please sign in to comment.