ajax-promise-es6
Promise based Ajax module for react/react-native apps.
##Installation:
npm i -S ajax-promise-es6
Usage:
import Ajax from 'ajax-promise-es6'
Ajax.post(url, body, headers).then((res)=> {
console.log(res);
}).catch((err)=> {
console.log(err);
});
Ajax.get(url, body, headers).then((res)=> {
console.log(res);
}).catch((err)=> {
console.log(err);
});
##Example:
Ajax.post(url,
{
foo: 'hello',
bar: 'there'
},
{
'Cookie': 'foo=bar'
}
).then((res)=> {
console.log(res);
}).catch((err)=>{
console.log(err);
});