-
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.
- Loading branch information
Showing
65 changed files
with
1,358 additions
and
587 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
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,7 @@ | ||
import { instance } from 'api'; | ||
import { MyPage } from 'types/api'; | ||
|
||
export const getMyPage = async (): Promise<MyPage> => { | ||
const response = await instance.get(`/api/mypage`); | ||
return response.data; | ||
}; |
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,18 +1,9 @@ | ||
/* -------- POST 요청 -------- */ | ||
import { instance } from 'api'; | ||
import { FieldValues } from 'react-hook-form'; | ||
|
||
// 문제 생성하기 & 대량 문제 생성하기 | ||
export const problemSet = async (formData: FieldValues) => { | ||
if (formData.length === 1) { | ||
const response = await instance.post('/api/question', formData[0]); | ||
return response.data; | ||
} | ||
const response = await instance.post('/api/questions', formData); | ||
|
||
if (formData.length > 1) { | ||
const response = await instance.post('/api/questions', formData); | ||
return response.data; | ||
} | ||
|
||
throw new Error('문제 생성에 실패했습니다.'); | ||
return response.data; | ||
}; |
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,39 +1,53 @@ | ||
import { instance } from 'api'; | ||
import { FieldValues } from 'react-hook-form'; | ||
// import { RequestDetail, ToggleRequestList } from 'types/api'; | ||
|
||
/* -------- Get 요청 -------- */ | ||
import { RequestDetail, ToggleRequestList } from 'types/api'; | ||
|
||
// 게시판 글 조회 | ||
// export const getRequest = async ( | ||
// id: string | undefined, | ||
// ): Promise<RequestDetail> => { | ||
// const response = await instance.get(`/api/request/${id}`); | ||
// return response.data; | ||
// }; | ||
export const getRequest = async ( | ||
id: string | undefined, | ||
): Promise<RequestDetail> => { | ||
const response = await instance.get(`/api/request/${id}`); | ||
return response.data; | ||
}; | ||
|
||
// 게시판 전체 리스트 / 내가 요청한 문제 조회 | ||
// export const getToggleRequestList = async ({ | ||
// page = 0, | ||
// size = 10, | ||
// query = 'list', | ||
// }): Promise<ToggleRequestList> => { | ||
// const response = await instance.get( | ||
// `/api/request/${query}?page=${page}&size=${size}`, | ||
// ); | ||
// return response.data; | ||
// }; | ||
|
||
/* -------- POST 요청 -------- */ | ||
export const getToggleRequestList = async ({ | ||
page = 0, | ||
size = 10, | ||
sort = 'list', | ||
}): Promise<ToggleRequestList> => { | ||
const response = await instance.get( | ||
`/api/request/requests?page=${page}&size=${size}&$sort=${sort}`, | ||
); | ||
return response.data; | ||
}; | ||
export const getRequestListTest = () => { | ||
const response = instance.get(`/api/request/requests`); | ||
return response; | ||
}; | ||
|
||
// 게시판 문제 요청글 생성 | ||
export const createRequest = (RequestForm: FieldValues) => { | ||
const response = instance.post('/api/request/create', RequestForm); | ||
const response = instance.post('/api/request', RequestForm); | ||
return response; | ||
}; | ||
|
||
// 게시글 상태 수정 | ||
// 게시글 상태(승인/대기) 수정 | ||
export const approveRequest = (RequestForm: FieldValues) => { | ||
const response = instance.post('/api/request/approve', RequestForm); | ||
const response = instance.put('/api/request/approve', RequestForm); | ||
return response; | ||
}; | ||
|
||
// 게시글 수정 | ||
export const editRequest = (RequestForm: FieldValues) => { | ||
const response = instance.put('/api/request', RequestForm); | ||
return response; | ||
}; | ||
|
||
// 게시글 삭제 | ||
export const deleteRequest = async ( | ||
id: string | undefined, | ||
): Promise<RequestDetail> => { | ||
const response = await instance.delete(`/api/request/${id}`); | ||
return response.data; | ||
}; |
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
File renamed without changes.
File renamed without changes.
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.