1.0.3 • Published 7 years ago

rest-trankil.js v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

rest-trankil.js

Usage

Init

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.

GET

const res = await rest.get(url, useCustomHeader = true)

POST

const res = await rest.post(url, body, useCustomHeader = true)

PUT

const res = await rest.put(url, body, useCustomHeader = true)

PATCH

const res = await rest.patch(url, body, useCustomHeader = true)

Run and code

yarn && yarn start
1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago