-
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.
Browse files
Browse the repository at this point in the history
Feature/#88 | 통계, 책정보 관련 api 연결
- Loading branch information
Showing
42 changed files
with
1,006 additions
and
279 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,130 @@ | ||
import { apiAuth } from "./api"; | ||
import { get, post, patch, put, del } from "./example"; | ||
|
||
// 한줄평,별점 목록 조회 | ||
export const getBookInfo = async ({ bookinfoId }) => { | ||
try { | ||
const res = await get(`/bookinfo/${bookinfoId}`); | ||
console.log("책정보 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("책정보 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
// 한줄평,별점 목록 조회 | ||
export const getOneLineRatingsInfo = async ({ | ||
bookinfoId, | ||
orderBy, | ||
page, | ||
size, | ||
}) => { | ||
try { | ||
// Query Parameter 생성 (값이 존재하는 경우에만 추가) | ||
const queryParams = new URLSearchParams(); | ||
if (orderBy) queryParams.append("orderBy", orderBy); | ||
if (page) queryParams.append("page", page); | ||
if (size) queryParams.append("size", size); | ||
|
||
// 최종 URL | ||
const url = `/bookinfo/${bookinfoId}/onelineratings${ | ||
queryParams.toString() ? `?${queryParams}` : "" | ||
}`; | ||
|
||
const res = await get(url); | ||
console.log("한줄평 목록 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("한줄평 목록 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
// 별점 등록 및 수정 | ||
export const enrollRating = async (userbookId, rating) => { | ||
const url = `books/${userbookId}/rating`; | ||
const data = { rating }; | ||
try { | ||
const res = await patch(url, data); | ||
console.log("별점 등록 성공: ", res); | ||
return res?.data; | ||
} catch (error) { | ||
console.error("별점 등록 실패:", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
//별점 삭제 | ||
export const deleteRating = async (userbookId) => { | ||
const url = `books/${userbookId}/rating`; | ||
try { | ||
const res = await del(url); | ||
console.log("별점 삭제 성공: ", res); | ||
} catch (error) { | ||
console.error("별점 삭제 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
//한줄평 생성 | ||
export const enrollOneLine = async (userBookId, oneLineContent) => { | ||
const url = `onelines`; | ||
const data = { oneLineContent, userBookId }; | ||
try { | ||
const res = await post(url, data); | ||
console.log("한줄평 등록 성공: ", res); | ||
return res?.data; | ||
} catch (error) { | ||
console.error("한줄평 등록 실패:", error); | ||
throw error; | ||
} | ||
}; | ||
// 한줄평 수정 | ||
export const editOneLine = async (onelineId, oneLineContent) => { | ||
const url = `onelines/${onelineId}`; | ||
const data = { oneLineContent }; | ||
try { | ||
const res = await put(url, data); | ||
console.log("한줄평 수정 성공: ", res); | ||
return res?.data; | ||
} catch (error) { | ||
console.error("한줄평 수정 실패:", error); | ||
throw error; | ||
} | ||
}; | ||
//한줄평 삭제 | ||
export const deleteOneLine = async (onelineId) => { | ||
const url = `onelines/${onelineId}`; | ||
try { | ||
const res = await del(url); | ||
console.log("한줄평 삭제 성공: ", res); | ||
} catch (error) { | ||
console.error("한줄평 삭제 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
//한줄평 좋아요 | ||
export const enrollLike = async (onelineId) => { | ||
const url = `onelines/${onelineId}/like`; | ||
try { | ||
const res = await post(url); | ||
console.log("한줄평 좋아요 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("한줄평 좋아요 실패:", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
//한줄평 좋아요 삭제 | ||
export const deleteLike = async (onelineId) => { | ||
const url = `onelines/${onelineId}/like`; | ||
try { | ||
const res = await del(url); | ||
console.log("한줄평 좋아요 삭제 성공: ", res); | ||
} catch (error) { | ||
console.error("한줄평 좋아요 삭제 실패: ", error); | ||
throw error; | ||
} | ||
}; |
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,38 @@ | ||
import { apiAuth } from "./api"; | ||
import { get, post, patch, put, del } from "./example"; | ||
|
||
// 유저 정보 조회 - 닉네임, 기록 수 | ||
export const getUserInfo = async (userId) => { | ||
try { | ||
const res = await get(`/users/${userId}`); | ||
console.log("유저 정보 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("유저 정보 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
// 유저 레벨 정보 조회 | ||
export const getUserLevelInfo = async (userId) => { | ||
try { | ||
const res = await get(`/users/${userId}/growth`); | ||
console.log("유저 레벨 정보 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("유저 레벨 정보 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
// 캐릭터 아이템 조회 | ||
export const getItemLists = async () => { | ||
try { | ||
const res = await get(`/useritems`); | ||
console.log("아이템 리스트 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("아이템 리스트 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; |
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,26 @@ | ||
import { apiAuth } from "./api"; | ||
import { get, post, patch, put, del } from "./example"; | ||
|
||
// 유저 정보 조회 - 닉네임, 기록 수 | ||
export const getUserInfo = async (userId) => { | ||
try { | ||
const res = await get(`/users/${userId}`); | ||
console.log("유저 정보 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("유저 정보 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
// 유저 독서 리포트 조회 - 통계 | ||
export const getUserStatisticsInfo = async (userId) => { | ||
try { | ||
const res = await get(`/users/${userId}/statistics`); | ||
console.log("유저 통계 정보 조회 성공: ", res); | ||
return res; | ||
} catch (error) { | ||
console.error("유저 통계 정보 조회 실패: ", error); | ||
throw error; | ||
} | ||
}; |
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.