1.0.6 • Published 6 years ago

fetchmore v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Fetch More

React Ajax based on browser's native fetch().

Installation

$ npm i fetchmore

GET method

import fetchmore from 'fetchmore';

fetchmore({
    url: 'http://localhost/?'
}, {
    username: 'chiro',
    email: 'chiro@fkguru.com',
}, console.log, console.warn);

Result:

http://localhost/?username=chiro&email=chiro%40fkguru.com

POST method

import fetchmore from 'fetchmore';

fetchmore({
    url: 'http://localhost/',
    method: 'POST'
}, {
    username: 'chiro',
    email: 'chiro@fkguru.com',
    products: [
        {id: 3, name: 'cake', price: 2000},
        {id: 4, name: 'coffe', price: 6000}
    ]
}, console.log, console.warn);

Parsed data:

username: chiro
email: chiro@fkguru.com
products[id][0]: 3
products[name][0]: cake
products[price][0]: 2000
products[id][1]: 4
products[name][1]: coffe
products[price][1]: 6000

Auto encoded data:

username=chiro&email=chiro%40fkguru.com&products[id][0]=3&products[name][0]=cake&products[price][0]=2000&products[id][1]=4&products[name][1]=coffe&products[price][1]=6000

License

This package distributed under MIT License

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago