Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor type #90

Merged
merged 17 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1334690
docs: μ ˆλŒ€ 경둜 λ‚΄μš© μˆ˜μ • 및 type에 λŒ€ν•œ 경둜 μΆ”κ°€
Low-ProFiles Nov 2, 2024
2a4eaa4
fix: axios instance 파일λͺ…이 라이브러리λͺ…κ³Ό 동일해 이λ₯Ό λ‹€λ₯΄κ²Œ μˆ˜μ •
Low-ProFiles Nov 2, 2024
211764e
fix: alarm api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
af6bf90
fix: calendar api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
e008864
fix: feedback api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
14ec685
fix: member api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
a947b03
fix: memo api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
0c26867
fix: notice api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
d2f2f6b
fix: storage api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
2a68b95
fix: team api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
eeed852
fix: todo api와 response type이 1:1둜 맀칭되게 μˆ˜μ •
Low-ProFiles Nov 2, 2024
108129b
fix: terms api νƒ€μž… 지정
Low-ProFiles Nov 2, 2024
02ff676
feat: api path url 생성
Low-ProFiles Nov 2, 2024
dc982dd
feat: response type을 μ œμ™Έν•œ type듀에 λŒ€ν•΄ types>common μ•ˆμ— 정리
Low-ProFiles Nov 2, 2024
e77d417
fix: μ ˆλŒ€ 경둜 μ •μ˜ 방식 μˆ˜μ •μ— λ”°λ₯Έ 적용
Low-ProFiles Nov 10, 2024
0ff22a9
# 컀밋 15κ°œκ°€ μ„žμΈ κ²°κ³Όμž…λ‹ˆλ‹€.
Low-ProFiles Nov 10, 2024
bad68da
chore: λΉŒλ“œ μ—λŸ¬ μˆ˜μ •
Low-ProFiles Nov 10, 2024
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
1,096 changes: 539 additions & 557 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { CalendarPage, ExtraCalendarPage } from '@pages/calendar';
import { LoginPage, LoginCompletePage } from '@pages/login';
import { ManagementPage, ExtraManagementPage } from '@pages/management';
import { MemoPage, ExtraMemoPage } from '@pages/memo';
import { MyPage, ExtraMyPage } from '@pages/mypage';
import { SharePage, ExtraSharePage } from '@pages/share';
import { TodoListPage, ExtraTodoListPage } from '@pages/todo-list';
import { CalendarPage, ExtraCalendarPage } from '@/pages/calendar';
import { LoginPage, LoginCompletePage } from '@/pages/login';
import { ManagementPage, ExtraManagementPage } from '@/pages/management';
import { MemoPage, ExtraMemoPage } from '@/pages/memo';
import { MyPage, ExtraMyPage } from '@/pages/mypage';
import { SharePage, ExtraSharePage } from '@/pages/share';
import { TodoListPage, ExtraTodoListPage } from '@/pages/todo-list';
import {
CreateTeamPage,
JoinTeamPage,
TeamPage,
ShareTeamPage
} from '@pages/team';
import ErrorPage from '@pages/error';
import { ProfilePage } from '@pages/mypage/profile';
import { PortfolioPage } from '@pages/mypage/portfolio';
import MainPage from '@pages/main/main';
import Layout from '@components/Layout';
import { SignupPage } from '@pages/signup/signup';
import { RequireAuth } from '@hooks/useRequireAuth';
} from '@/pages/team';
import ErrorPage from '@/pages/error';
import { ProfilePage } from '@/pages/mypage/profile';
import { PortfolioPage } from '@/pages/mypage/portfolio';
import MainPage from '@/pages/main/main';
import Layout from '@/components/Layout';
import { SignupPage } from '@/pages/signup/signup';
import { RequireAuth } from '@/hooks/useRequireAuth';

const App = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/apis/alarm/getAlarmList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Axios } from '@apis/axios';
import { AxiosInstance } from '@/apis/new/axios-instance';

export const getAlarm = async (teamId: number | null) => {
const token = localStorage.getItem('accessToken');
Expand All @@ -8,7 +8,7 @@ export const getAlarm = async (teamId: number | null) => {
}

try {
const response = await Axios.get(`/api/alarm/${teamId}`, {
const response = await AxiosInstance.get(`/api/alarm/${teamId}`, {
withCredentials: true,
headers: {
Accept: 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions src/apis/alarm/updatePassword.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Axios } from '@apis/axios';
import { AxiosInstance } from '@/apis/new/axios-instance';

export const updateAlarmStatus = async (alarmId: number) => {
const token = localStorage.getItem('accessToken');
Expand All @@ -8,7 +8,7 @@ export const updateAlarmStatus = async (alarmId: number) => {
}

try {
const response = await Axios.patch(`/api/alarm/${alarmId}`, {
const response = await AxiosInstance.patch(`/api/alarm/${alarmId}`, {
withCredentials: true,
headers: {
Accept: 'application/json',
Expand Down
8 changes: 0 additions & 8 deletions src/apis/axios.ts

This file was deleted.

18 changes: 9 additions & 9 deletions src/apis/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
import { Axios } from './axios';
import { AxiosInstance } from '@/apis/new/axios-instance';
import { CreateEventProps, UpdateEventProps } from 'src/types/calendar';

export const getTeamMember = async (teamId: number) => {
const response = await Axios.get(`/api/team/${teamId}/member`);
const response = await AxiosInstance.get(`/api/team/${teamId}/member`);
return response;
};

export const createCalendarEvent = async (
teamId: number,
event: CreateEventProps
) => {
const response = await Axios.post(`/api/team/${teamId}/calendar`, event);
const response = await AxiosInstance.post(`/api/team/${teamId}/calendar`, event);
return response;
};

export const updateCalendarEvent = async (
eventId: number,
data: UpdateEventProps
) => {
const response = await Axios.patch(`/api/calendar/${eventId}`, data);
const response = await AxiosInstance.patch(`/api/calendar/${eventId}`, data);
return response;
};

export const updateEventState = async (eventId: number) => {
const response = await Axios.patch(`/api/calendar/${eventId}/state`);
const response = await AxiosInstance.patch(`/api/calendar/${eventId}/state`);
return response;
};

export const deleteCalendarEvent = async (eventId: number) => {
const response = await Axios.delete(`/api/calendar/${eventId}`);
const response = await AxiosInstance.delete(`/api/calendar/${eventId}`);
return response;
};

export const getCalendarEventList = async (
teamId: number,
month: number | null
) => {
const response = await Axios.get(
const response = await AxiosInstance.get(
`/api/team/${teamId}/calendar?month=${month}`
);
return response;
};

export const getCalendarEventDetail = async (calendarId: number) => {
const response = await Axios.get(`/api/calendar/${calendarId}`);
const response = await AxiosInstance.get(`/api/calendar/${calendarId}`);
return response;
};

export const getUpcomingEvent = async (teamId: number) => {
const response = await Axios.get(`/api/team/${teamId}/calendar/coming`);
const response = await AxiosInstance.get(`/api/team/${teamId}/calendar/coming`);
return response;
};
4 changes: 2 additions & 2 deletions src/apis/login/postTerms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Axios } from '@apis/Axios';
import { AxiosInstance } from '@/apis/new/axios-instance';
import { TermProps } from 'src/types/term';

export const postTerms = async ({ termsOfUse, privacyPolicy }: TermProps) => {
Expand All @@ -9,7 +9,7 @@ export const postTerms = async ({ termsOfUse, privacyPolicy }: TermProps) => {
}

try {
const response = await Axios.post(
const response = await AxiosInstance.post(
`/api/terms`,
{ termsOfUse, privacyPolicy },
{
Expand Down
10 changes: 5 additions & 5 deletions src/apis/main.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { Axios } from './axios';
import { AxiosInstance } from '@/apis/new/axios-instance';

export const getTeamInfo = async (teamId: number) => {
const response = await Axios.get(`/api/team/${teamId}`);
const response = await AxiosInstance.get(`/api/team/${teamId}`);
return response;
};

export const getNoticeRecent = async (teamId: number) => {
const response = await Axios.get(`/api/team/${teamId}/notice/recent`);
const response = await AxiosInstance.get(`/api/team/${teamId}/notice/recent`);
return response;
};

export const getNoticeList = async (teamId: number) => {
const response = await Axios.get(`/api/team/${teamId}/notice`);
const response = await AxiosInstance.get(`/api/team/${teamId}/notice`);
return response;
};

export const createNotice = async (teamId: number, notice: string) => {
const response = await Axios.post(`/api/team/${teamId}/notice`, {
const response = await AxiosInstance.post(`/api/team/${teamId}/notice`, {
content: notice
});
return response;
Expand Down
28 changes: 14 additions & 14 deletions src/apis/management.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Axios } from '@apis/axios.ts';
import { AxiosInstance } from '@/apis/new/axios-instance.ts';
import { ScheduleRequestBody, TeamData } from '../types/management.ts';

// λ‚΄ νŒ€ 쑰회
Expand All @@ -9,7 +9,7 @@ export const getMyTeam = async () => {
}

try {
const response = await Axios.get(`/api/member/team`);
const response = await AxiosInstance.get(`/api/member/team`);
return response.data.result.teamList;
} catch (error) {
console.error(error);
Expand All @@ -20,7 +20,7 @@ export const getMyTeam = async () => {
// νŒ€ 쑰회
export const getTeamData = async (teamId: number): Promise<TeamData> => {
try {
const response = await Axios.get(`/api/team/${teamId}`);
const response = await AxiosInstance.get(`/api/team/${teamId}`);
return response.data.result.team;
} catch (error) {
console.log(error);
Expand All @@ -31,7 +31,7 @@ export const getTeamData = async (teamId: number): Promise<TeamData> => {
// νŒ€ 멀버 쑰회 (μ—­ν• νƒœκ·Έ 포함)
export const getMembers = async (teamId: number) => {
try {
const response = await Axios.get(`/api/team/${teamId}/member/detail`);
const response = await AxiosInstance.get(`/api/team/${teamId}/member/detail`);
return response.data.result.teamMember;
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -59,7 +59,7 @@ export const updateProfile = async (
formData.append('imageFile', imageFile);
}

const response = await Axios.patch(`/api/team/${teamId}`, formData, {
const response = await AxiosInstance.patch(`/api/team/${teamId}`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
Expand All @@ -80,7 +80,7 @@ export const updateTag = async (
name: string
) => {
try {
const response = await Axios.patch(`/api/team/${teamId}/tag/${tagId}`, {
const response = await AxiosInstance.patch(`/api/team/${teamId}/tag/${tagId}`, {
name: name
});
console.log(response.data);
Expand All @@ -94,7 +94,7 @@ export const updateTag = async (
// μ—­ν•  νƒœκ·Έ 생성
export const createRoleTag = async (teamManageId: number, name: string) => {
try {
const response = await Axios.post(`/api/management/${teamManageId}/role`, {
const response = await AxiosInstance.post(`/api/management/${teamManageId}/role`, {
name: name
});
console.log(response.data);
Expand All @@ -112,7 +112,7 @@ export const updateRoleTag = async (
name: string
) => {
try {
const response = await Axios.patch(
const response = await AxiosInstance.patch(
`/api/management/${teamManageId}/role/${tagId}`,
{
name: name
Expand All @@ -129,7 +129,7 @@ export const updateRoleTag = async (
// μ—­ν•  νƒœκ·Έ μ‚­μ œ
export const deleteRoleTag = async (teamManageId: number, tagId: number) => {
try {
await Axios.delete(`/api/management/${teamManageId}/role/${tagId}`);
await AxiosInstance.delete(`/api/management/${teamManageId}/role/${tagId}`);
console.log('μ—­ν•  νƒœκ·Έ μ‚­μ œ');
} catch (error) {
console.error(error);
Expand All @@ -140,7 +140,7 @@ export const deleteRoleTag = async (teamManageId: number, tagId: number) => {
// μŠ€μΌ€μ€„ 쑰회
export const getSchedules = async (teamId: number) => {
try {
const response = await Axios.get(`/api/team/${teamId}/schedule`);
const response = await AxiosInstance.get(`/api/team/${teamId}/schedule`);
return response.data.result;
} catch (error) {
console.error(error);
Expand All @@ -151,7 +151,7 @@ export const getSchedules = async (teamId: number) => {
// λ‚΄ μŠ€μΌ€μ€„ 쑰회
export const getMySchedules = async (teamId: number) => {
try {
const response = await Axios.get(`/api/schedule/${teamId}`);
const response = await AxiosInstance.get(`/api/schedule/${teamId}`);
return response.data.result.scheduleDto;
} catch (error) {
console.error(error);
Expand All @@ -165,7 +165,7 @@ export const createSchedule = async (
scheduleData: ScheduleRequestBody
) => {
try {
const response = await Axios.post(
const response = await AxiosInstance.post(
`/api/team/${teamId}/schedule`,
scheduleData
);
Expand All @@ -182,7 +182,7 @@ export const updateSchedule = async (
scheduleData: ScheduleRequestBody
) => {
try {
const response = await Axios.patch(
const response = await AxiosInstance.patch(
`/api/team/${teamId}/schedule`,
scheduleData
);
Expand All @@ -197,7 +197,7 @@ export const updateSchedule = async (
// λ‚΄ μŠ€μΌ€μ€„ μ‚­μ œ
export const deleteSchedule = async (teamManageId: number) => {
try {
await Axios.delete(`/api/team/${teamManageId}/schedule`);
await AxiosInstance.delete(`/api/team/${teamManageId}/schedule`);
} catch (error) {
console.log('μŠ€μΌ€μ€„ μ‚­μ œ μ‹€νŒ¨!');
}
Expand Down
12 changes: 6 additions & 6 deletions src/apis/memo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Axios } from '@apis/axios.ts';
import { AxiosInstance } from '@/apis/new/axios-instance.ts';
import { MemoResponse } from '../types/memo.ts';

// λ©”λͺ¨ 쑰회
export const getMemos = async (teamId: number): Promise<MemoResponse> => {
const response = await Axios.get<MemoResponse>(`/api/team/${teamId}/memo`);
const response = await AxiosInstance.get<MemoResponse>(`/api/team/${teamId}/memo`);
return response.data;
};

Expand All @@ -15,7 +15,7 @@ export const createMemo = async (
content: string
) => {
try {
const response = await Axios.post(`/api/team/${teamId}/memo`, {
const response = await AxiosInstance.post(`/api/team/${teamId}/memo`, {
title: title,
tagList: tagList,
content: content
Expand All @@ -30,7 +30,7 @@ export const createMemo = async (
// λ©”λͺ¨ κ°œλ³„ 쑰회
export const getMemoById = async (memoId: number) => {
try {
const response = await Axios.get(`/api/memo/${memoId}`);
const response = await AxiosInstance.get(`/api/memo/${memoId}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -46,7 +46,7 @@ export const updateMemo = async (
content: string
) => {
try {
const response = await Axios.patch(`api/memo/${memoId}`, {
const response = await AxiosInstance.patch(`api/memo/${memoId}`, {
title: title,
tagList: tagList,
content: content
Expand All @@ -61,7 +61,7 @@ export const updateMemo = async (
// λ©”λͺ¨ μ‚­μ œ
export const deleteMemo = async (memoId: number) => {
try {
await Axios.delete(`/api/memo/${memoId}`);
await AxiosInstance.delete(`/api/memo/${memoId}`);
console.log('λ©”λͺ¨ μ‚­μ œ');
} catch (error) {
console.log(error);
Expand Down
6 changes: 3 additions & 3 deletions src/apis/mypage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Axios } from './axios';
import { AxiosInstance } from '@/apis/new/axios-instance';
import { ProfileResponse } from 'src/types/profile';

// λ‚΄ ν”„λ‘œν•„ 쑰회
export const getProfile = async (): Promise<ProfileResponse> => {
try {
const response = await Axios.get<ProfileResponse>(`/api/member`);
const response = await AxiosInstance.get<ProfileResponse>(`/api/member`);
return response.data;
} catch (error) {
console.error('Failed to fetch profile:', error);
Expand Down Expand Up @@ -36,7 +36,7 @@ export const updateProfile = async (
formData.append('image', image);
}

const response = await Axios.patch(`/api/member`, formData, {
const response = await AxiosInstance.patch(`/api/member`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
Expand Down
Loading
Loading