0.0.1 • Published 6 years ago

axios-serializy v0.0.1

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

npm.io npm.io npm.io npm.io npm.io npm.io npm.io

🚀 Installation

$ npm i -S axios-serializy
# or using yarn
$ yarn add axios-serializy

📚 Usage

import axios from 'axios-serializy'

const api = axios.create({
  baseURL: 'https://your-api.com'
})

// ...

const { data } = await api.get('/client/1234', {
  model: ClientModel
})

console.log(data) // your serialized client model

Also if you want to serialize error messages from server you need to call axios.setErrorModel(Model)
Before creating axios instance

axios.setErrorModel(YourPrettifiedErrorModel)

const api = axios.create({
  baseURL: 'https://your-api.com'
})

📝 License

Licensed under the MIT License.