Skip to content

Commit 72fb67f

Browse files
authored
Merge pull request #105 from GDGoCINHA/develop
Fix(#4)/ 프록시 대상 주소 재변경
2 parents 547190e + da4fbb1 commit 72fb67f

File tree

11 files changed

+24
-22
lines changed

11 files changed

+24
-22
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// 예시: /api/auth/[action]/route.js
21
import { NextResponse } from 'next/server';
32
import axios from 'axios';
43

src/components/study/dashboard/admin/view/CreatedStudies.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function CreatedStudies() {
5656
</tr>
5757
</thead>
5858
<tbody>
59-
{Array.isArray(data) && data.length > 0 ? (
59+
{Array.isArray(data) && data?.length > 0 ? (
6060
data.map((data) => (
6161
<tr
6262
key={data.id}

src/components/study/dashboard/my/view/AppliedStudies.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function AppliedStudies() {
5757
</tr>
5858
</thead>
5959
<tbody>
60-
{data.length > 0 ? (
60+
{data?.length > 0 ? (
6161
data.map((data) => (
6262
<tr
6363
key={data.studyId}

src/components/study/ui/card/ApplicantInfoList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function ApplicantInfoList({
4545
</tr>
4646
</thead>
4747
<tbody>
48-
{applications.length === 0 ? (
48+
{applications?.length === 0 ? (
4949
<tr>
5050
<td colSpan="4" className="py-4 text-center text-gray-500">
5151
아직 지원자가 없습니다. ㅠㅠ

src/hooks/study/useApplicantDetail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const useApplicantDetail = (apiClient, studyId, applicantId) => {
1414
setApplicantDetail(getAttendeeDetailsByStudyId.data);
1515
} else {
1616
const resApplicantDetail = await apiClient.get(`/study/${studyId}/attendee/${applicantId}`);
17-
setApplicantDetail(resApplicantDetail.data);
17+
setApplicantDetail(resApplicantDetail?.data?.data);
1818
}
1919
} catch (err) {
2020
setError(err);
@@ -24,7 +24,7 @@ export const useApplicantDetail = (apiClient, studyId, applicantId) => {
2424
};
2525

2626
fetchApplicantDetailData();
27-
}, []);
27+
}, [studyId, applicantId]);
2828

2929
return { applicantDetail, isLoading, error };
3030
};

src/hooks/study/useApplicantList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const useApplicantList = (apiClient, studyId) => {
1414
setApplicantList(getAttendeesByStudyId.data.attendees);
1515
} else {
1616
const resApplicant = await apiClient.get(`/study/${studyId}/attendee?page=1`);
17-
setApplicantList(resApplicant.data.attendees);
17+
setApplicantList(resApplicant?.data?.data?.attendees);
1818
}
1919
} catch (err) {
2020
setError(err);
@@ -24,7 +24,7 @@ export const useApplicantList = (apiClient, studyId) => {
2424
};
2525

2626
fetchApplicantListData();
27-
}, []);
27+
}, [studyId]);
2828

2929
return { applicantList, isLoading, error };
3030
};

src/hooks/study/useAppliedStudyList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const useAppliedStudyList = (apiClient) => {
1616
setRecruitedAppliedStudyList(getMyStudyApplyResult.data.recruited);
1717
} else {
1818
const resCreatedStudy = await apiClient.get('/study/attendee/result');
19-
setRecruitingAppliedStudyList(resCreatedStudy.data.recruiting);
20-
setRecruitedAppliedStudyList(resCreatedStudy.data.recruited);
19+
setRecruitingAppliedStudyList(resCreatedStudy?.data?.data?.recruiting);
20+
setRecruitedAppliedStudyList(resCreatedStudy?.data?.data?.recruited);
2121
}
2222
} catch (err) {
2323
setError(err);

src/hooks/study/useCreatedStudyList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const useCreatedStudyList = (apiClient) => {
1616
setRecruitedCreatedStudyList(getCreatedStudiesByStatus.data.recruited);
1717
} else {
1818
const resCreatedStudy = await apiClient.get('/study/me');
19-
setRecruitingCreatedStudyList(resCreatedStudy.data.recruiting);
20-
setRecruitedCreatedStudyList(resCreatedStudy.data.recruited);
19+
setRecruitingCreatedStudyList(resCreatedStudy?.data?.data?.recruiting);
20+
setRecruitedCreatedStudyList(resCreatedStudy?.data?.data?.recruited);
2121
}
2222
} catch (err) {
2323
setError(err);

src/hooks/study/useStudyAccessCheck.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ export const useStudyAccessCheck = (apiClient, studyId) => {
1616
setIsStudyLead(getCreatedStudiesByStatus.data.recruiting.some(study => study.id === Number(studyId)) || getCreatedStudiesByStatus.data.recruited.some(study => study.id === Number(studyId)));
1717
} else {
1818
const resAppliedStudy = await apiClient.get(`/study/attendee/result`);
19-
setIsStudyApplicant(resAppliedStudy.data.recruiting.some(study => study.studyId === Number(studyId)) || resAppliedStudy.data.recruited.some(study => study.studyId === Number(studyId)));
19+
// 얘는 recruited가 없는데? 버근가? -> 아무것도 지원 안한 상태긴함 ㅇㅇ
20+
setIsStudyApplicant(resAppliedStudy?.data?.data?.recruiting?.some(study => study?.studyId === Number(studyId)) || resAppliedStudy?.data?.data?.recruited?.some(study => study?.studyId === Number(studyId)));
2021
const resCreatedStudy = await apiClient.get('/study/me');
21-
setIsStudyLead(resCreatedStudy.data.recruiting.some(study => study.id === Number(studyId)) || resCreatedStudy.data.recruited.some(study => study.id === Number(studyId)));
22+
setIsStudyLead(resCreatedStudy?.data?.data?.recruiting?.some(study => study?.id === Number(studyId)) || resCreatedStudy?.data?.data?.recruited?.some(study => study?.id === Number(studyId)));
2223
}
2324
} catch (err) {
2425
setError(err);
@@ -28,7 +29,7 @@ export const useStudyAccessCheck = (apiClient, studyId) => {
2829
};
2930

3031
fetchPermissionData();
31-
}, []);
32+
}, [studyId]);
3233

3334
// 이 스터디가 네놈의 것이 맞느냐?
3435
// 홀홀 그대는 정직한 유저구나 true를 반환하여주겠다

src/hooks/study/useStudyDetail.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ export const useStudyDetail = (apiClient, studyId) => {
2626
}
2727
} else {
2828
const resStudyDetail = await apiClient.get(`/study/${studyId}`);
29-
setStudyDetail(resStudyDetail.data);
30-
setStudyLead(resStudyDetail.data.creator);
31-
setIsRecruiting(resStudyDetail.data.status === "RECRUITING");
29+
setStudyDetail(resStudyDetail?.data?.data);
30+
setStudyLead(resStudyDetail?.data?.data?.creator);
31+
setIsRecruiting(resStudyDetail?.data?.data?.status === "RECRUITING");
3232

3333
const resApplications = await apiClient.get('/study/attendee/result');
34-
if (resApplications.data.recruiting.some((application) => application.studyId === Number(studyId))) {
34+
if (resApplications?.data?.data?.recruiting?.some((study) => study?.studyId === Number(studyId))) {
3535
setIsApplied(true);
36+
} else {
37+
setIsApplied(false);
3638
}
3739
}
3840
} catch (error) {
@@ -43,7 +45,7 @@ export const useStudyDetail = (apiClient, studyId) => {
4345
};
4446

4547
fetchStudyDetailData();
46-
}, []);
48+
}, [studyId]);
4749

4850
return { studyDetail, studyLead, isRecruiting, isApplied, isLoading, error };
4951
};

0 commit comments

Comments
 (0)