-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from Project-Catcher/feat/my-schedule
Feat: 내 일정 페이지 추가 구현
- Loading branch information
Showing
50 changed files
with
2,977 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
import axios from "axios"; | ||
|
||
export const getAllSchedule = async ( | ||
tab?: string, | ||
title?: string, | ||
startDate?: Date, | ||
endDate?: Date, | ||
) => { | ||
let tabParam; | ||
|
||
if (tab === "진행 예정") { | ||
tabParam = "proceed"; | ||
} else if (tab === "진행중/완료 일정") { | ||
tabParam = "ongoing"; | ||
} | ||
|
||
return await axios.get(`${process.env.NEXT_PUBLIC_BASE_URL}/getAllSchedule`, { | ||
params: { | ||
tab: tabParam, | ||
title, | ||
startDate, | ||
endDate, | ||
}, | ||
}); | ||
}; | ||
|
||
export const getRecruitSchedule = async ( | ||
tab?: string, | ||
title?: string, | ||
startDate?: Date, | ||
endDate?: Date, | ||
) => { | ||
let tabParam; | ||
|
||
if (tab === "모집 중/예정") { | ||
tabParam = "proceed"; | ||
} else if (tab === "모집 완료") { | ||
tabParam = "ongoing"; | ||
} | ||
|
||
return await axios.get( | ||
`${process.env.NEXT_PUBLIC_BASE_URL}/getRecruitSchedule`, | ||
{ | ||
params: { | ||
tab: tabParam, | ||
title, | ||
startDate, | ||
endDate, | ||
}, | ||
}, | ||
); | ||
}; | ||
|
||
export const getParticipateSchedule = async ( | ||
tab?: string, | ||
title?: string, | ||
startDate?: Date, | ||
endDate?: Date, | ||
) => { | ||
let tabParam = 0; | ||
|
||
if (tab === "승인 대기 중") { | ||
tabParam = 1; | ||
} else if (tab === "승인 완료") { | ||
tabParam = 2; | ||
} else if (tab === "승인 거절") { | ||
tabParam = 3; | ||
} | ||
|
||
return await axios.get( | ||
`${process.env.NEXT_PUBLIC_BASE_URL}/getParticipateSchedule`, | ||
{ | ||
params: { | ||
tab: tabParam, | ||
title, | ||
startDate, | ||
endDate, | ||
}, | ||
}, | ||
); | ||
}; | ||
|
||
export const getScrapSchedule = async ( | ||
title?: string, | ||
startDate?: Date, | ||
endDate?: Date, | ||
) => { | ||
return await axios.get( | ||
`${process.env.NEXT_PUBLIC_BASE_URL}/getScrapSchedule`, | ||
{ | ||
params: { | ||
title, | ||
startDate, | ||
endDate, | ||
}, | ||
}, | ||
); | ||
}; | ||
|
||
export const getTemporarySchedule = async ( | ||
title?: string, | ||
startDate?: Date, | ||
endDate?: Date, | ||
) => { | ||
return await axios.get( | ||
`${process.env.NEXT_PUBLIC_BASE_URL}/getTemporarySchedule`, | ||
{ | ||
params: { | ||
title, | ||
startDate, | ||
endDate, | ||
}, | ||
}, | ||
); | ||
}; | ||
|
||
export const getMainSchedule = async () => { | ||
try { | ||
const response = await axios.all([ | ||
getAllSchedule(), | ||
getRecruitSchedule(), | ||
getParticipateSchedule(), | ||
getTemporarySchedule(), | ||
]); | ||
|
||
// axios.spread를 사용하여 각 요청의 결과를 개별적으로 처리 | ||
const [ | ||
allSchedule, | ||
recruitSchedule, | ||
participateSchedule, | ||
temporarySchedule, | ||
] = response; | ||
|
||
// 각 요청의 데이터를 반환합니다. | ||
return { | ||
allSchedule: allSchedule.data, | ||
recruitSchedule: recruitSchedule.data, | ||
participateSchedule: participateSchedule.data, | ||
temporarySchedule: temporarySchedule.data, | ||
}; | ||
} catch (error) { | ||
console.error("API 호출 중 오류 발생:", error); | ||
throw error; // 오류를 호출자에게 전달 | ||
} | ||
}; | ||
|
||
export const getApplicantsList = async (id: number) => { | ||
return await axios.get( | ||
`${process.env.NEXT_PUBLIC_BASE_URL}/getApplicantsList`, | ||
{ | ||
params: { | ||
id, | ||
}, | ||
}, | ||
); | ||
}; | ||
|
||
export const getItemList = async (title?: string) => { | ||
return await axios.get(`${process.env.NEXT_PUBLIC_BASE_URL}/getItemList`, { | ||
params: { | ||
title, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
//모든 일정 페이지 | ||
import All from "@schedule/components/All"; | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
|
||
const create = () => { | ||
return <All />; | ||
return ( | ||
<ScheduleWrapper> | ||
<All />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default create; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
// 내 일정 페이지 | ||
import Main from "@schedule/components/Main"; | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
import React from "react"; | ||
|
||
const index = () => { | ||
return <Main />; | ||
return ( | ||
<ScheduleWrapper> | ||
<Main />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default index; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Items from "@schedule/components/Items"; | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
import React from "react"; | ||
|
||
const items = () => { | ||
return ( | ||
<ScheduleWrapper> | ||
<Items />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Participate from "@schedule/components/Participate"; | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
import React from "react"; | ||
|
||
const participate = () => { | ||
return ( | ||
<ScheduleWrapper> | ||
<Participate />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default participate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Recruit from "@schedule/components/Recruit"; | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
import React from "react"; | ||
|
||
const recruit = () => { | ||
return ( | ||
<ScheduleWrapper> | ||
<Recruit />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default recruit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
import Scrap from "@schedule/components/Scrap"; | ||
import React from "react"; | ||
|
||
const participate = () => { | ||
return ( | ||
<ScheduleWrapper> | ||
<Scrap />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default participate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ScheduleWrapper from "@schedule/components/ScheduleWrapper"; | ||
import Temporary from "@schedule/components/Temporary"; | ||
import React from "react"; | ||
|
||
const temporary = () => { | ||
return ( | ||
<ScheduleWrapper> | ||
<Temporary />; | ||
</ScheduleWrapper> | ||
); | ||
}; | ||
|
||
export default temporary; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.