axios-serializy
v0.0.1
Published
integration axios with serializy
Downloads
6
Maintainers
Readme
🚀 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.