1.0.2-0 • Published 6 years ago

axios-singleton v1.0.2-0

Weekly downloads
25
License
MIT
Repository
github
Last release
6 years ago

Axios Singleton Instance

Axios Singleton Instance for Node and Browserify projects

Quick start

import axios from 'axios-singleton'

const axiosInstance: any = axios
const result = await axiosInstance.get('https://api.github.com/users/Quynh-Nguyen')

...

If you want to customize headers

import axios from 'axios-singleton'

const axiosInstance: any = axios
axiosInstance.setConfigure({
  baseURL: 'https://api.github.com',
  headers: {
    common: {
      'Content-Type': 'application/json'
    }
  }
})

const result = await axiosInstance.get('/users/Quynh-Nguyen')

...

If you want to set Bearer token to headers

import axios from 'axios-singleton'

const axiosInstance: any = axios
axiosInstance.setHeaderToken('YOUR_TOKEN')

...
1.0.2-0

6 years ago

1.0.1

6 years ago

1.0.0-beta

6 years ago

1.0.0-alpha

6 years ago

1.0.0

6 years ago