2.1.10 • Published 5 years ago

requestapijs v2.1.10

Weekly downloads
16
License
MIT
Repository
github
Last release
5 years ago

Request Api JS

Access json api with ease

Features

Browser Support

ChromeFirefoxSafari
Latest ✔Latest ✔Latest ✔

Installing

Using npm:

$ npm install requestapijs

Using yarn:

$ yarn add requestapijs

Example


Get Request

new Api().get(URLS.COMPANY)
    .setHeader('authorization', localStorage.getItem('token'))
    .success(
      response => { #DO something },
    )
    .error(e => apiErrorHandler(e))
    .done();

Put Request

new Api().put(URLS.COMPANY, id, value)
    .setHeader('authorization', localStorage.getItem('token'))
    .success(
      response => {
        #Do something
      },
    ).error(
      error => { onError && onError(error); apiErrorHandler(error); },
    ).done();

Post

new Api().post(URLS.COMPANY, value)
    .setHeader('authorization', localStorage.getItem('token'))
    .success(
      response => {
        COMPANY_REDUCER.fetchCompany();
        onSuccess && onSuccess(response);
      },
    ).error(
      error => { onError && onError(error); apiErrorHandler(error); },
    ).done();
2.1.10

5 years ago

2.1.9

5 years ago

2.1.8

6 years ago

2.1.7

6 years ago

2.1.6

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.0

7 years ago

0.9.9

7 years ago

0.9.8

7 years ago

0.9.7

7 years ago

0.9.6

7 years ago

0.9.5

7 years ago

0.9.4

7 years ago

0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago