1.0.13 • Published 7 years ago

simple_fetch v1.0.13

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

simele_fetch function

based on fetch api

fetch api

your browser must support window.fetch or fetch api's pollyfill

REQUIREMENT

the format of your server's response:

// success:
{
    ok: true,
    data: {}
}

// error:
{
    ok: false,
    code: 1,
    msg: 'error message'
}

return:

fetch.js returns a promise, resolve when ok, or reject with error message.

examples

import ajax from 'simple_fetch'
ajax({
    url: '/some/api'
    body: {
      foo: 'bar'
    }
  }).then((data) => {
    this.setState({
      someSt: data
    })
  }).catch((err) => {
    console.log(err)
  })
1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago