-
Notifications
You must be signed in to change notification settings - Fork 0
PR:review api 생성했습니다 #69
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
base: main
Are you sure you want to change the base?
Changes from all commits
df4cccb
2050637
7680a20
fcae176
05c7536
c904b2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| import { axiosInstance } from "."; | ||
|
|
||
| /** | ||
| * 리뷰등록 | ||
| * @function | ||
| * @parameter payListIdx : number - 리뷰등록 idx | ||
| * @parameter title : string - 제목 | ||
| * @parameter content: string - 내용 | ||
| * @parameter ondo : number - 온도 | ||
| * @parameter images : File[] - 이미지 | ||
| * @returns {Promise} | ||
| * @description | ||
| * - 리뷰 등록을 위한 API | ||
| * - 온도는 전체 온도 나누기 상품 판매의 갯수입니다. | ||
| ex) 전체 온도 70도 / 판매갯수 2 => 35도 | ||
| - 요청결과 200("success") || 400("failure") | ||
| */ | ||
| export const postReviewByPayListIdx = async ({ | ||
| payListIdx, | ||
| title, | ||
| content, | ||
| ondo, | ||
| images, | ||
| }) => { | ||
| const response = await axiosInstance.post( | ||
| "/review", | ||
| { params: { payList_idx: payListIdx } }, | ||
| { title, content, ondo, images } | ||
| ); | ||
|
|
||
| return response; | ||
| }; | ||
|
|
||
| /** | ||
| * 2.리뷰 목록 조회 | ||
| * @function | ||
| * @parameter page: number - 조회할 리뷰들의 page | ||
| * @description 리뷰들의 목록을 보여주는 api | ||
| */ | ||
|
|
||
| export const getReviewByPage = async ({ page }) => { | ||
| const response = await axiosInstance.get("/review", { params: { page } }); | ||
| return response.data; | ||
| }; | ||
|
|
||
| /** | ||
| * 3.리뷰 상세 | ||
| * @function | ||
| * @parameter reviewIdx: number - 조회할 리뷰의 idx | ||
| * @description | ||
| * - 특정한 하나의 review를 나타내는 API | ||
| * - 요청한 특정 리뷰가 상세히 조회됩니다 | ||
| */ | ||
|
|
||
| export const getReviewGetByReviewIdx = async ({ reviewIdx }) => { | ||
| const response = await axiosInstance.get("/review/get", { | ||
| params: { review_idx: reviewIdx }, | ||
| }); | ||
| return response.data; | ||
| }; | ||
| /** | ||
| * 4.리뷰 수정 | ||
| * @function | ||
| * @parameter reviewIdx : number - 수정할 리뷰의 idx | ||
| * @parameter title : string - 새로운 제목 | ||
| * @parameter content : string - 새로운 내용 | ||
| * @parameter ondo : number - 새로운 온도 | ||
| * @parameter imgUrl: string[] - 새로운 서브 기존 이미지 url[] | ||
| * @parameter mainUrl: stirng - 새로운 메인 기존 이미지 url | ||
| * @parameter images: File[] - 새로운 이미지 파일 목록 | ||
| * @description | ||
| * - 등록 물품 검색을 위한 API | ||
| * - images 는 main_url이 있다면 [0]~[3]sub, main_url이 없다면 [0]main, [1~3]sub | ||
| * - 요청결과 200("success") || 400("failure") | ||
| */ | ||
|
|
||
| export const patchReviewByReviewIdx = async ({ | ||
| reviewIdx, | ||
| title, | ||
| content, | ||
| ondo, | ||
| imgUrl, | ||
| mainUrl, | ||
| images, | ||
| }) => { | ||
| const response = await axiosInstance.patch( | ||
| "/review", | ||
| { params: { review_idx: reviewIdx } }, | ||
| { title, content, ondo, img_url: imgUrl, main_url: mainUrl, images } | ||
| ); | ||
| return response; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Request Level
Description
|
||
| }; | ||
| /** | ||
| * 5.리뷰 삭제 | ||
| * @function | ||
| * @parameter reviewIdx : number - 삭제할 리뷰의 idx | ||
| * @description | ||
| * - 등록 물품 검색을 위한 API | ||
| * - 요청결과 200("success") || 400("failure") | ||
| */ | ||
| export const deleteReviewByReviewIdx = async ({ reviewIdx }) => { | ||
| const response = await axiosInstance.delete("/review", { | ||
| params: { review_idx: reviewIdx }, | ||
| }); | ||
| return response; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Request Level
Description
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. api요청에따라 데이터 값만 필요한 조회(목록,상세)부분은 response.data로 해주었고 나머지 3요청들은 header 및데이터 외의 값이 필요한게있다고 해서 response로 주었습니다 |
||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request Level
Description