twopi-network-utils
v1.1.7
Published
A set of network utilities to improve code reusability across javascript projects.
Downloads
16
Keywords
Readme
twopicode-network-utils
##Instructions
import { requestFactory, GET, POST, POST_FILE, PUT, DELETE, PATCH } from 'twopicode-network-utils'
const get = requestFactory(GET)
const post = requestFactory(POST)
const post_file = requestFactory(POST_FILE)
const put = requestFactory(PUT)
const delete = requestFactory(DELETE)
const patch = requestFactory(PATCH)
get('http://example.com/api').then(resp => {
console.log(resp)
})
You can optionally pass a function to the factory that triggers a notification. The function takes a single string - the message to be printed.
For any more information you'll have to read the source, sorry!