-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into postdetailapi
- Loading branch information
Showing
18 changed files
with
646 additions
and
356 deletions.
There are no files selected for viewing
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,36 @@ | ||
import client from "./client"; | ||
import { getCookie } from "./cookie"; | ||
|
||
const token = getCookie('accessToken'); | ||
|
||
// TIL 글 상세 조회 | ||
export const getTILDetail = async ({ tilId }) => { | ||
console.log(tilId); | ||
return await client.get(`/api/tils/${tilId}`); | ||
}; | ||
|
||
// TIL 글 작성 조회 | ||
export const postTIL = async (tilData) => { | ||
return await client.post(`/api/til`, tilData, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
// TIL 글 알고리즘 조회 | ||
export const getAlgorithms = async () => { | ||
return await client.get(`/api/algorithms`); | ||
}; | ||
|
||
// TIL 글 수정 조회 | ||
export const putTIL = async ({ tilId }) => { | ||
console.log(tilId); | ||
return await client.put(`/api/tils/${tilId}`); | ||
}; | ||
|
||
// TIL 글 삭제 조회 | ||
export const deleteTIL = async ({ tilId }) => { | ||
console.log(tilId); | ||
return await client.delete(`/api/tils/${tilId}`); | ||
}; |
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 |
---|---|---|
@@ -1,13 +1,30 @@ | ||
// import client from "./client"; | ||
import client from "./client"; | ||
import { getCookie } from "./cookie"; | ||
|
||
const token = getCookie("accessToken"); | ||
|
||
// TIL 글 목록 조회 | ||
export const getTIL = async ({ pageNumber }) => { | ||
return await client.get(`/api/tils?page=${pageNumber}`); | ||
return await client.get(`/api/tils?page=${pageNumber}`, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
// 챌린지 목록 조회 | ||
export const getChallenges = async ({ pageSize }) => { | ||
return await client.get(`/api/challenges?page=${pageSize}`); | ||
}; | ||
|
||
// TIL 글 상세 조회 | ||
export const getTILDetail = async ({ tilId }) => { | ||
console.log(tilId); | ||
return await client.get(`/api/tils/${tilId}`); | ||
}; | ||
|
||
// 챌린지 상세 문제 조회 | ||
export const getChallengeDetail = async ({ challengeId }) => { | ||
return await client.get(`/api/challenges/${challengeId}`); | ||
}; |
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,31 @@ | ||
import client from "./client"; | ||
import { getCookie } from "./cookie"; | ||
|
||
const token = getCookie("accessToken"); | ||
|
||
// 내 글 목록 조회 | ||
export const getMyTILs = async ({ pageSize }) => { | ||
return await client.get(`/api/mypage/tils?page=${pageSize}`, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
// 좋아요 글 목록 조회 | ||
export const getLikeTILs = async ({ pageSize }) => { | ||
return await client.get(`/api/mypage/likes?page=${pageSize}`, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
// 통계 조회 | ||
export const getStatistics = async ({ pageSize }) => { | ||
return await client.get(`/api/mypage/statistics`, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,29 @@ | ||
import React from "react"; | ||
import { ReactSVG } from "react-svg"; | ||
import Arrowdown from "../../assets/Arrow down.svg"; | ||
|
||
const Dropdown = ({ name = null, value, options, placeholder, onChange }) => { | ||
return ( | ||
<div className="relative w-full"> | ||
<select | ||
value={name === "algorithm" ? options[value] : value} | ||
className="w-full px-4 py-2 text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm appearance-none focus:outline-none focus:ring-1 focus:ring-orange-200" | ||
onChange={onChange} | ||
> | ||
<option value="" disabled selected hidden> | ||
{placeholder} | ||
</option> | ||
{options.map((option, index) => ( | ||
<option key={index} value={name === "algorithm" ? index + 1 : option}> | ||
{option} | ||
</option> | ||
))} | ||
</select> | ||
<div className="absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none"> | ||
<ReactSVG src={Arrowdown} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
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
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
Oops, something went wrong.