Repository URL to install this package:
|
Version:
2.0.11 ▾
|
import { defineFinal } from 'chain-able-boost'
import { asyncWrap } from 'chain-able-lego/dist/wrap/asyncWrap'
import { axiosInstance } from './ENV'
// wrapper around axios for handling errors in a sane way
// without rejected promises that are hard to track
const GET = asyncWrap(axiosInstance.get)
const POST = asyncWrap(axiosInstance.post)
const AXIOSER = asyncWrap(axiosInstance)
const FETCHREQUEST = asyncWrap(axiosInstance.request)
defineFinal(GET, 'methodName', 'GET')
defineFinal(POST, 'methodName', 'POST')
defineFinal(AXIOSER, 'methodName', 'AXIOSER')
defineFinal(FETCHREQUEST, 'methodName', 'REQUEST')
export { GET, POST, AXIOSER, FETCHREQUEST, API_LAYER_IMPORT }
export { asyncWrap }
export { axiosInstance as axios }
// fetch specific settings - unused currently because we are using axios
// these will be used for when we use webworkers
//
// getInit = {
// method: 'GET',
// mode: 'no-cors',
// }