diff --git a/next.config.mjs b/next.config.mjs index b4f5ba2..e530e8f 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -30,14 +30,7 @@ export default withPlugins( }, }, ], - [ - typescript, - { - typescriptLoaderOptions: { - transpileOnly: false, - }, - }, - ], + [typescript], ], nextConfig ); diff --git a/src/apis/auth/postKakaoToken.tsx b/src/apis/auth/postKakaoToken.tsx index bca7d40..fd7dca0 100644 --- a/src/apis/auth/postKakaoToken.tsx +++ b/src/apis/auth/postKakaoToken.tsx @@ -11,7 +11,7 @@ export async function postKakaoToken( ): Promise { try { const response = await axios.post( - "https://api.ncp.simproject.kr/api/v1/auth/login/KAKAO", + "https://api.schoolpoint.site/api/v1/auth/login/KAKAO", { accessToken: accessToken, } diff --git a/src/apis/school/getShcool.tsx b/src/apis/school/getShcool.tsx index 9f8e0a3..bd89ef5 100644 --- a/src/apis/school/getShcool.tsx +++ b/src/apis/school/getShcool.tsx @@ -7,7 +7,7 @@ interface GetSchoolResponse { export async function getSchool(keyword: string): Promise { const response = await axios.get( - `https://api.ncp.simproject.kr/api/v1/schools?keyword=${keyword}` + `https://api.schoolpoint.site/api/v1/schools?keyword=${keyword}` ); return response.data; } diff --git a/src/apis/user/postUser.tsx b/src/apis/user/postUser.tsx index db65bdf..21c26f7 100644 --- a/src/apis/user/postUser.tsx +++ b/src/apis/user/postUser.tsx @@ -4,7 +4,7 @@ import axios from "axios"; export async function postUser(user: PostUserRequest): Promise { try { const response = await axios.post( - "https://api.ncp.simproject.kr/api/v1/users", + "https://api.schoolpoint.site/api/v1/users", user ); return response.data; diff --git a/src/components/home/MealTablePopup.tsx b/src/components/home/MealTablePopup.tsx index 5ecb1a2..a064d2e 100644 --- a/src/components/home/MealTablePopup.tsx +++ b/src/components/home/MealTablePopup.tsx @@ -47,7 +47,7 @@ const MealTablePopup = ({ onClose }: { onClose: () => void }) => { .then((response) => { const mealTableData: MealTable[] = response.data.menus; setMealTable(mealTableData); - + console.log(mealTableData); /* 월 계산 */ let month = mealTableData[0].date.slice(5, 7); if (month[0] === "0") { @@ -58,38 +58,32 @@ const MealTablePopup = ({ onClose }: { onClose: () => void }) => { const weeklyMealTable: MealTable[][] = []; let currentWeek: MealTable[] = []; /* 주차별 시작일 */ - let currentWeekStartDay: number | null = null; mealTableData.forEach((meal) => { const mealDate = new Date(meal.date); - const mealDay = mealDate.getDate(); const mealDayOfWeek = mealDate.getDay(); - /* 이번 주차 시작일 */ - if (currentWeekStartDay === null) { - currentWeekStartDay = mealDay; + /* 주차별로 월요일에 새로운 주차를 시작 */ + if (mealDayOfWeek === 1 && currentWeek.length > 0) { + weeklyMealTable.push(currentWeek); + currentWeek = []; } - /* 이번 주차에 있는 날짜인지 확인 */ + currentWeek.push(meal); + + /* 마지막 날에 현재 주차 데이터를 추가 */ + const lastMealDate = new Date( + mealTableData[mealTableData.length - 1].date + ); if ( - (currentWeekStartDay !== null && - mealDay >= currentWeekStartDay && - mealDay < currentWeekStartDay + 5 && - mealDayOfWeek !== 0) || // 일요일 제외 - currentWeek.length === 0 + mealDayOfWeek === 5 || + mealDate.getTime() === lastMealDate.getTime() ) { - currentWeek.push(meal); - } else { weeklyMealTable.push(currentWeek); - currentWeek = [meal]; - currentWeekStartDay = mealDay; + currentWeek = []; } }); - if (currentWeek.length > 0) { - weeklyMealTable.push(currentWeek); - } - setWeeklyMealTable(weeklyMealTable); }) .catch(() => {