ajax is a small wrapper around
- Allows globally registering request and response interceptors
- Throws on 4xx and 5xx status codes
- Prevents network request if a request interceptor returns a response
- Supports a JSON request which automatically encodes/decodes body request and response payload as JSON
- Adds accept-language header to requests based on application language
- Adds XSRF header to request if the cookie is present
npm i --save @lion/ajax
ajax delegates all requests to fetch.
ajax.requestJson have the same function signature as
window.fetch, you can use any online resource to learn more about fetch. MDN is a great start.