npm.io
1.0.5 • Published 2 years ago

@stone-ton/axios-wrapper

Licence
MIT
Version
1.0.5
Deps
0
Size
28 kB
Vulns
0
Weekly
0

axios-wrapper

Lib para fazer wrapper do axios

Usage

import { AxiosRequestConfig } from 'axios'
import {
  axiosRequest
} from '@stone-ton/axios-wrapper'

interface FooInput {
  bar: string
}

interface Foo {
  id: string
  bar: string
}

const result = await axiosRequest<Foo, FooInput>({
  url: 'http://localhost:3000',
  method: 'POST',
  timeout: 3000,
  data: {
    bar: '🍌'
  }
})

// result = {
//   data: { id: '12':  bar: '🍌' }
// }