Skip to content

Commit

Permalink
fix: 명세에 맞게 api를 수정한다
Browse files Browse the repository at this point in the history
  • Loading branch information
airman5573 committed Jul 19, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent b7dc853 commit daa8ab1
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/api/getStudyDetail.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { StudyDetail } from '@custom-types/index';
import axiosInstance from './axiosInstance';

const getStudyDetail = async (studyId: string): Promise<{ study: StudyDetail }> => {
const response = await axiosInstance.get<{ study: StudyDetail }>(`/api/study/?study-id=${studyId}`);
const response = await axiosInstance.get<{ study: StudyDetail }>(`/api/studies/${studyId}`);
return response.data;
};

2 changes: 1 addition & 1 deletion frontend/src/api/getStudyReviews.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ export type StudyReviewResponse = {
};

const getStudyReviews = async (studyId: string, size: number, loadAll: boolean): Promise<StudyReviewResponse> => {
const url = loadAll ? `/api/studies/${studyId}/review` : `/api/studies/${studyId}/review?size=${size}`;
const url = loadAll ? `/api/studies/${studyId}/reviews` : `/api/studies/${studyId}/review?size=${size}`;
const response = await axiosInstance.get<StudyReviewResponse>(url);
return response.data;
};
4 changes: 2 additions & 2 deletions frontend/src/mocks/detail-study-handlers.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import reviewJSON from './reviews.json';
import studiesJSON from './studies.json';

const detailStudyHandlers = [
rest.get('/api/study', (req, res, ctx) => {
rest.get('/api/studies', (req, res, ctx) => {
const studyId = req.url.searchParams.get('study-id');

const study = studiesJSON.studies.find(study => String(study.id) === studyId);
@@ -16,7 +16,7 @@ const detailStudyHandlers = [
);
}),

rest.get('/api/studies/:studyId/review', (req, res, ctx) => {
rest.get('/api/studies/:studyId/reviews', (req, res, ctx) => {
const size = req.url.searchParams.get('size');
if (size) {
const sizeNum = Number(size);

0 comments on commit daa8ab1

Please sign in to comment.