# @damilaredev/axios-wrapper

> Axios Wrapper

Latest version **0.1.1** (published 2023-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @damilaredev/axios-wrapper
pnpm add @damilaredev/axios-wrapper
yarn add @damilaredev/axios-wrapper
bun add @damilaredev/axios-wrapper
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-01-23 |
| First published | 2022-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Damilare Anjorin |
| Maintainers | damilaredev |

## Links

- npm: https://www.npmjs.com/package/@damilaredev/axios-wrapper
- Repository: https://github.com/damilaredevone/ts-plugin-starter
- Homepage: https://github.com/damilaredevone/ts-plugin-starter#readme
- Issues: https://github.com/damilaredevone/ts-plugin-starter/issues
- npm.io page: https://npm.io/package/@damilaredev/axios-wrapper

## Recent versions

- 0.1.1 (latest) — 2023-01-23
- 0.0.4 — 2022-05-21
- 0.0.3 — 2022-05-01
- 0.0.2 — 2022-05-01
- 0.0.1 — 2022-05-01

## README

# Axios Wrapper

### Install

```bash
// using npm
npm i axios @damilaredev/axios-wrapper --save

// using yarn
yarn add axios @damilaredev/axios-wrapper --save

// using pnpm
pnpm i axios @damilaredev/axios-wrapper
```

### Methods

- $post
- $get
- $put
- $delete
- $patch

### Usage

```ts
//ES6 or Typescript
import { $post, $get } from '@damilaredev/vue-axios'

// CommonJS
const { $post, $get } = require('@damilaredev/vue-axios')

export const saveUser = async () => {
  await $post({
    url: `your-url`,
    headers,
    data,
    onSuccess: (response: AxiosResponse<T>) => console.log(response),
    onError: (error: AxiosError) => console.log(error),
  })
}

export const getUser = async () => {
  await $get({
    url: `your-url`,
    headers,
    onSuccess: (response: AxiosResponse) => console.log(response),
    onError: (error) => console.log(error),
  })
}
```

### Adding headers

By using headers option, it adds extra headers in addition to the request default headers:

```ts
await $get({
  url: `your-url`,
  headers: {
    Accept: 'application/json',
  },
})
```

---
_Source: https://npm.io/package/@damilaredev/axios-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
