-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1404 from woowacourse/refactor/1403-axios
Refactor/#1403 api axios 사용하는 파일 리팩터링
- Loading branch information
Showing
5 changed files
with
30 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { createAxiosInstance } from '../utils/axiosInstance'; | ||
import { CurriculumListResponse } from '../models/Keywords'; | ||
|
||
const instanceWithoutToken = createAxiosInstance(); | ||
const customAxios = createAxiosInstance(); | ||
|
||
export const getCurriculums = async () => { | ||
const response = await instanceWithoutToken.get<CurriculumListResponse>(`/curriculums`); | ||
const response = await customAxios.get<CurriculumListResponse>(`/curriculums`); | ||
|
||
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
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,28 +1,28 @@ | ||
import { createAxiosInstance } from '../utils/axiosInstance'; | ||
import { LevellogRequest } from '../models/Levellogs'; | ||
|
||
const instanceWithoutToken = createAxiosInstance(); | ||
const customAxios = createAxiosInstance(); | ||
|
||
export const requestGetLevellogs = async (currPage: number) => { | ||
const params = currPage !== 1 ? `?page=${currPage}` : ''; | ||
|
||
const { data } = await instanceWithoutToken.get(`/levellogs${params}`); | ||
const { data } = await customAxios.get(`/levellogs${params}`); | ||
|
||
return data; | ||
}; | ||
|
||
export const createNewLevellogRequest = (body: LevellogRequest) => | ||
instanceWithoutToken.post(`/levellogs`, body); | ||
customAxios.post(`/levellogs`, body); | ||
|
||
export const requestGetLevellog = async (id) => { | ||
const { data } = await instanceWithoutToken.get(`/levellogs/${id}`); | ||
const { data } = await customAxios.get(`/levellogs/${id}`); | ||
|
||
return data; | ||
}; | ||
|
||
export const requestDeleteLevellog = async (id) => { | ||
instanceWithoutToken.delete(`/levellogs/${id}`); | ||
customAxios.delete(`/levellogs/${id}`); | ||
}; | ||
|
||
export const requestEditLevellog = (id, body: LevellogRequest) => | ||
instanceWithoutToken.put(`/levellogs/${id}`, body); | ||
customAxios.put(`/levellogs/${id}`, body); |
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