import Rest from 'xeonys-rest-client'
import { store } from './store'
const headers = () => ({
Authorization: `token ${store.getState().user.token}`,
'Content-Type': 'application/json',
})
export new Rest(headers)
Need a fetch polyfill for IE, and babel-polyfill for every browsers.
const res = await rest.get(url, useCustomHeader = true)
const res = await rest.post(url, body, useCustomHeader = true)
const res = await rest.put(url, body, useCustomHeader = true)
const res = await rest.patch(url, body, useCustomHeader = true)
yarn && yarn start