refactor: Add each method options
This commit is contained in:
parent
b57c6d47a9
commit
9809fc8885
@ -40,59 +40,59 @@ export function useAxios(lang = '') {
|
||||
// response 추가 로직
|
||||
axios.interceptors.request.use(undefined, (error) => {})
|
||||
|
||||
const get = async ({ url }) => {
|
||||
const get = async ({ url, option = {} }) => {
|
||||
return await getInstances(url)
|
||||
.get(url)
|
||||
.get(url, option)
|
||||
.then((res) => res.data)
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
const promiseGet = async ({ url }) => {
|
||||
return await getInstances(url).get(url)
|
||||
const promiseGet = async ({ url, option = {} }) => {
|
||||
return await getInstances(url).get(url, option)
|
||||
}
|
||||
|
||||
const post = async ({ url, data }) => {
|
||||
const post = async ({ url, data, option = {} }) => {
|
||||
return await getInstances(url)
|
||||
.post(url, data)
|
||||
.post(url, data, option)
|
||||
.then((res) => res.data)
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
const promisePost = async ({ url, data }) => {
|
||||
return await getInstances(url).post(url, data)
|
||||
const promisePost = async ({ url, data, option = {} }) => {
|
||||
return await getInstances(url).post(url, data, option)
|
||||
}
|
||||
|
||||
const put = async ({ url, data }) => {
|
||||
const put = async ({ url, data, option = {} }) => {
|
||||
return await getInstances(url)
|
||||
.put(url, data)
|
||||
.put(url, data, option)
|
||||
.then((res) => res.data)
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
const promisePut = async ({ url, data }) => {
|
||||
return await getInstances(url).put(url, data)
|
||||
const promisePut = async ({ url, data, option = {} }) => {
|
||||
return await getInstances(url).put(url, data, option)
|
||||
}
|
||||
|
||||
const patch = async ({ url, data }) => {
|
||||
const patch = async ({ url, data, option = {} }) => {
|
||||
return await getInstances(url)
|
||||
.patch(url, data)
|
||||
.patch(url, data, option)
|
||||
.then((res) => res.data)
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
const promisePatch = async ({ url, data }) => {
|
||||
return await getInstances(url).patch(url, data)
|
||||
const promisePatch = async ({ url, data, option = {} }) => {
|
||||
return await getInstances(url).patch(url, data, option)
|
||||
}
|
||||
|
||||
const del = async ({ url }) => {
|
||||
const del = async ({ url, option = {} }) => {
|
||||
return await getInstances(url)
|
||||
.delete(url)
|
||||
.delete(url, option)
|
||||
.then((res) => res.data)
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
const promiseDel = async ({ url }) => {
|
||||
return await getInstances(url).delete(url)
|
||||
const promiseDel = async ({ url, option = {} }) => {
|
||||
return await getInstances(url).delete(url, option)
|
||||
}
|
||||
|
||||
return { get, promiseGet, post, promisePost, put, promisePut, patch, promisePatch, del, promiseDel }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user