Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Layout from './layouts/Layout';
import MobileLayout from './layouts/MobileLayout';
import PrivateRoute from './layouts/PrivateRoute';
import AdminPage from './pages/Admin';
import FilteredLetterManage from './pages/Admin/FilteredLetter';
import FilteringManage from './pages/Admin/Filtering';
import ReportManage from './pages/Admin/Report';
import AdminRollingPaper from './pages/Admin/RollingPaper';
Expand Down Expand Up @@ -84,7 +83,6 @@ const App = () => {
<Route path="admin" element={<AdminPage />}>
<Route path="report" element={<ReportManage />} />
<Route path="badwords" element={<FilteringManage />} />
<Route path="filtered-letter" element={<FilteredLetterManage />} />
<Route path="rolling-paper" element={<AdminRollingPaper />} />
</Route>
</Route>
Expand Down
9 changes: 1 addition & 8 deletions src/apis/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const getReports = async (reportQueryString: ReportQueryString) => {
const queryStrings = queryParams.toString();
const res = await client.get(`/api/reports?${queryStrings}`);
if (!res) throw new Error('신고 목록 데이터 조회 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand All @@ -32,9 +31,8 @@ const getReports = async (reportQueryString: ReportQueryString) => {

const patchReport = async (reportId: number, patchReportRequest: PatchReportRequest) => {
try {
console.log(`/api/reports/${reportId}`, patchReportRequest);
const res = await client.patch(`/api/reports/${reportId}`, patchReportRequest);
console.log(res);
return res;
} catch (error) {
console.error(error);
}
Expand All @@ -45,7 +43,6 @@ const getBadWords = async () => {
try {
const res = await client.get('/api/bad-words');
if (!res) throw new Error('금칙어 조회 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand All @@ -55,7 +52,6 @@ const getBadWords = async () => {
const postBadWords = async (badWordsRequest: BadWords) => {
try {
const res = await client.post('/api/bad-words', badWordsRequest);
console.log(res);
if (!res) throw new Error('금칙어 등록 도중 에러가 발생했습니다.');
return res;
} catch (error) {
Expand All @@ -69,7 +65,6 @@ const patchBadWordsUsed = async (badWordId: string, isUsed: string) => {
try {
const res = await client.patch(`/api/bad-words/${badWordId}/status`, { isUsed: reverseIsUsed });
if (!res) throw new Error('검열 활성화/비활성화 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand All @@ -80,7 +75,6 @@ const patchBadWords = async (badWordId: string, word: string) => {
try {
const res = await client.patch(`/api/bad-words/${badWordId}`, { word: word });
if (!res) throw new Error('금칙어 수정중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand All @@ -91,7 +85,6 @@ const deleteBadWords = async (id: string) => {
try {
const res = await client.delete(`/api/bad-words/${id}`);
if (!res) throw new Error('금칙어 삭제 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand Down
6 changes: 0 additions & 6 deletions src/apis/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const getNewToken = async () => {
try {
const response = await client.post('/api/reissue', {}, { withCredentials: true });
if (!response) throw new Error('getNewToken: no response data');
console.log(response.data);
return response;
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -64,15 +63,10 @@ export const deleteUserInfo = async () => {

export const postLogout = async () => {
try {
console.log(' before logout');

const response = await client.post('/api/logout', { withCredentials: true });
console.log('logout', response);
if (!response) throw new Error('postLogout: failed to logout');
return response;
} catch (error) {
console.log('logout error');

console.error(error);
}
};
1 change: 0 additions & 1 deletion src/apis/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ client.interceptors.request.use(
const accessToken = useAuthStore.getState().accessToken;
if (config.url !== '/api/reissue' && accessToken) {
config.headers.Authorization = `Bearer ${accessToken}`;
console.log('interceptor', config);
}
return config;
},
Expand Down
2 changes: 0 additions & 2 deletions src/apis/draftLetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface DraftLetter {
export const getDraftLetters = async (): Promise<DraftLetter[]> => {
try {
const { data } = await client.get('/api/letters?status=draft');
console.log('임시저장된 편지 데이터', data);
return data.data;
} catch (error) {
console.error('❌임시저장된 편지를 불러오던 중 에러가 발생했습니다', error);
Expand All @@ -28,7 +27,6 @@ export const deleteDraftLetters = async (letterId: number) => {
const { data } = await client.delete(`/api/letters/${letterId}/temporary-save`);

if (data.data?.letterId) {
console.log('삭제된 임시저장 편지 ID:', data.data.letterId);
} else {
console.error('❌서버 응답에 letterId가 존재하지 않습니다.');
}
Expand Down
1 change: 0 additions & 1 deletion src/apis/incomingLetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import client from './client';
export const getIncomingLetters = async () => {
try {
const { data } = await client.get('/api/letters?status=delivery');
console.log('오고있는 편지 데이터', data);
return data;
} catch (error) {
console.error('❌오고 있는 편지 목록을 불러오던 중 에러 발생', error);
Expand Down
4 changes: 0 additions & 4 deletions src/apis/letterDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const getLetter = async (letterId: string) => {
try {
const res = await client.get(`/api/letters/${letterId}`);
if (!res) throw new Error('편지 데이터를 가져오는 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand All @@ -13,10 +12,8 @@ const getLetter = async (letterId: string) => {

const deleteLetter = async (letterId: string) => {
try {
console.log(`/api/letters/${letterId}`);
const res = await client.delete(`/api/letters/${letterId}`);
if (!res) throw new Error('편지 삭제 요청 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand All @@ -29,7 +26,6 @@ const postEvaluateLetter = async (letterId: number, evaluation: LetterEvaluation
evaluation: evaluation,
});
if (!res) throw new Error('편지 삭제 요청 도중 에러가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand Down
1 change: 0 additions & 1 deletion src/apis/mailBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const getMailbox = async () => {
export const getMailboxDetail = async (id: number, pageParam: number) => {
try {
const response = await client.get(`/api/mailbox/${id}/detail?page=${pageParam}&size=20`);
console.log(response.data);
if (!response) throw new Error('error while fetching mailbox detail data');
return response.data;
} catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions src/apis/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const getTimeLines = async () => {
try {
const res = await client.get('/api/timelines');
if (!res) throw new Error('타임라인을 받아오는 도중 오류가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -35,7 +34,6 @@ const getNotReadCount = async () => {
try {
const res = await client.get('/api/notifications/not-read');
if (!res) throw new Error('안 읽은 알림 수를 가져오는 도중 오류가 발생했습니다.');
console.log(res);
return res;
} catch (error) {
console.error(error);
Expand Down
2 changes: 1 addition & 1 deletion src/apis/randomLetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const deleteRandomLetterMatching = async () => {
if (!res) throw new Error('매칭 취소 도중 에러가 발생했습니다.');
return res;
} catch (error) {
console.log(error);
throw error;
}
};

Expand Down
2 changes: 0 additions & 2 deletions src/apis/rolling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const getRollingPaperDetail = async (
size,
},
});
console.log(data);
return data;
};

Expand Down Expand Up @@ -92,7 +91,6 @@ export const patchRollingPaper = async (eventPostId: number | string) => {
const {
data: { data },
} = await client.patch(`/api/admin/event-posts/${eventPostId}/status`);
console.log(data);
return data;
} catch (error) {
console.error(error);
Expand Down
4 changes: 0 additions & 4 deletions src/apis/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export const getSharePostList = async (page: number = 1, size: number = 10) => {
const response = await client.get('/api/share-posts', {
params: { page, size },
});
console.log(`🌟공유 게시글 목록`, response.data.data);

return response.data.data;
} catch (error) {
Expand All @@ -83,7 +82,6 @@ export const getSharePostList = async (page: number = 1, size: number = 10) => {
export const getSharePostDetail = async (sharePostId: string): Promise<SharePost> => {
try {
const response = await client.get(`/api/share-posts/${sharePostId}`);
console.log(`🔥공유 게시글 상세 데이터`, response.data);
return response.data.data;
} catch (error) {
console.error('❌ 편지 공유 게시글을 상세 조회하던 중 에러가 발생했습니다', error);
Expand Down Expand Up @@ -115,7 +113,6 @@ export const postShareProposals = async (
export const getShareProposalList = async () => {
try {
const response = await client.get('/api/share-proposals/inbox');
console.log(`🌟공유 요청 목록`, response.data);

return response.data.data;
} catch (error) {
Expand All @@ -130,7 +127,6 @@ export const getShareProposalDetail = async (
): Promise<ShareProposalDetail> => {
try {
const response = await client.get(`/api/share-proposals/${shareProposalId}`);
console.log(`😎공유 요청 상세 조회 데이터 `, response.data);
return response.data.data;
} catch (error) {
console.error('❌ 편지 공유 요청을 상세 조회하던 중 에러가 발생했습니다', error);
Expand Down
1 change: 0 additions & 1 deletion src/apis/unreadLetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import client from './client';
export const getUnreadLettersCount = async (): Promise<UnreadLetters> => {
try {
const response = await client.get('/api/letters/unread/count');
console.log('📩 안 읽은 편지 개수 데이터', response);
return response.data;
} catch (error) {
console.error('❌안 읽은 편지 개수를 받아오던 중 에러가 발생했습니다', error);
Expand Down
3 changes: 0 additions & 3 deletions src/apis/write.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import client from './client';

const postLetter = async (data: LetterRequest) => {
console.log('request', data);
try {
const res = await client.post('/api/letters', data);
if (!res) throw new Error('편지 전송과정에서 오류가 발생했습니다.');
Expand All @@ -14,7 +13,6 @@ const postLetter = async (data: LetterRequest) => {
};

const postFirstReply = async (data: FirstReplyRequest) => {
console.log('Firstrequest', data);
try {
const res = await client.post('/api/random-letters/matching', data);
if (!res) throw new Error('최초 답장 전송과정에서 오류가 발생했습니다.');
Expand Down Expand Up @@ -45,7 +43,6 @@ const postTemporarySave = async (data: TemporaryRequest) => {
};

const postTemporaryLetter = async (data: TemporaryRequest) => {
console.log('Temporary request', data);
try {
const res = await client.post('/api/letters', data);
if (!res) throw new Error('편지 전송과정에서 오류가 발생했습니다.');
Expand Down
4 changes: 4 additions & 0 deletions src/components/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function MenuButton() {
: 'pointer-events-none translate-y-[120%] rotate-180 opacity-0',
)}
onClick={() => setIsOpen(false)}
aria-label="내 편지함으로 이동하기"
>
<MarkunreadOutlinedIcon fontSize="small" />
</Link>
Expand All @@ -34,6 +35,7 @@ export default function MenuButton() {
: 'pointer-events-none translate-y-[120%] rotate-180 opacity-0',
)}
onClick={() => setIsOpen(false)}
aria-label="게시판으로 이동하기"
>
<CalendarTodayOutlinedIcon fontSize="small" />
</Link>
Expand All @@ -46,6 +48,7 @@ export default function MenuButton() {
: 'pointer-events-none translate-y-[120%] rotate-180 opacity-0',
)}
onClick={() => setIsOpen(false)}
aria-label="속마음 나누기로 이동하기"
>
<EditNoteRoundedIcon fontSize="medium" />
</Link>
Expand All @@ -56,6 +59,7 @@ export default function MenuButton() {
isOpen ? 'rotate-90' : 'rotate-0',
)}
onClick={() => setIsOpen((state) => !state)}
aria-label="메뉴 열기"
>
<MenuRoundedIcon />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NotificationButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function NotificationButton() {
});

return (
<Link to="/mypage/notifications" className="relative">
<Link to="/mypage/notifications" className="relative" aria-label="알림">
{notReadCount > 0 && (
<div className={notReadStyle}>{notReadCount < 100 ? notReadCount : '99+'}</div>
)}
Expand Down
1 change: 0 additions & 1 deletion src/components/ReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const ReportModal = ({ reportType, letterId, onClose }: ReportModalProps) => {
const res = await postReports(postReportRequest);
if (res?.status === 200) {
setToastActive({ title: '신고가 접수되었습니다.', toastType: 'Success' });
console.log(res);
onClose();
} else {
setToastActive({ title: '신고한 이력이 있습니다.', toastType: 'Error' });
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResultLetter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function ResultLetter({
const today = `${date.getFullYear()}년 ${date.getMonth() + 1}월 ${date.getDate()}일`;

return (
<LetterWrapper className="min-w-[300px]">
<LetterWrapper className="w-[300px]">
<div className="flex w-full flex-col gap-[35px]">
<div className="flex justify-between gap-3">
<div className="flex flex-col gap-2.5">
Expand Down
12 changes: 2 additions & 10 deletions src/hooks/useServerSentEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ export const useServerSentEvents = () => {

useEffect(() => {
if (!accessToken) {
// console.log('로그인 정보 확인불가');
return;
}

const connectSSE = () => {
const accessToken = useAuthStore.getState().accessToken;

try {
// console.log('구독 시작');
sourceRef.current = new EventSourcePolyfill(
`${import.meta.env.VITE_API_URL}/api/notifications/sub`,
{
Expand All @@ -60,19 +58,16 @@ export const useServerSentEvents = () => {
);

sourceRef.current.onmessage = (event) => {
// console.log(event);
// console.log('알림 수신');
handleOnMessage(event.data);
};

sourceRef.current.onerror = async (event) => {
console.log(event);
const errorEvent = event as unknown as { status?: number };
if (errorEvent.status === 401) {
try {
await useAuthStore.getState().refreshToken();
} catch (error) {
console.log('다른 api에서 리프레시 토큰 호출중입니다.');
throw error;
}
closeSSE();
reconnect = setTimeout(connectSSE, 5000);
Expand All @@ -82,14 +77,13 @@ export const useServerSentEvents = () => {
}
};
} catch (error) {
console.log('catch문에서 에러 발생', error);
throw error;
}
};

connectSSE();

return () => {
// console.log('컴포넌트 언마운트로 인한 구독해제');
closeSSE();
};
}, [accessToken]);
Expand All @@ -99,6 +93,4 @@ export const useServerSentEvents = () => {
sourceRef.current?.close();
sourceRef.current = null;
};

// return { closeSSE };
};
Loading