0.3.1 • Published 2 years ago

@softphant/axios-wrapper v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Axios wrapper

Wrapper was designed to use mostly Apisauce-compatible API, but latest axios version.

Basic usage

Creating a new API

const config = {
  url: 'localhost:3000',
  timeout: 30000,
  headers: {}
}

const api = createApi({
    url: config.url,
    timeout: config.timeout,
    headers: config.headers,
})

Api calls

const response: ApiResponse<ResponseInterface> = await api.get('/todos')
if (response.ok) {
  // Handle successful api call
  handleSuccess(response.data)
} else {
  // Handle errors. Response contains originalError, statusCode and apisauce-like problem.
}
0.3.0

2 years ago

0.3.1

2 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago