fettch
v0.1.0
Published
A simple promise fetch/XHR wrapper.
Downloads
2
Readme
fettch
A simple promise fetch/XHR wrapper.
method
, url
, headers: {}
, data: {}
Install
npm i -s fettch
import fettch from 'fettch'
or
import fettch from '//unpkg.com/fettch'
GET Example
fettch({
url: '//jsonplaceholder.typicode.com/posts'
}).then(response => {
console.log(response)
})
POST Example
fettch({
method: 'POST',
url: '/api/auth/signin',
data: {
user,
pass
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(data => {
console.log(data)
}).catch(err => {
console.log(err)
})
Cheers, Linus