axios-serializy
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

axios + serializy

⚡️ Integration serializy with axios ⚡️

🚀 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.

Package Sidebar

Install

npm i axios-serializy

Weekly Downloads

4

Version

0.0.1

License

MIT

Unpacked Size

21.7 kB

Total Files

12

Last publish

Collaborators

  • acacode