Skip to content

acacode/axios-serializy

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published