Skip to content

Releases: lexich/redux-api

Version 0.9.10

12 Sep 10:22
Compare
Choose a tag to compare
  • Update: default adapter
  • Catch all uncatched promise errors
  • add responseHandler

0.9.0: Merge pull request #60 from lexich/crud-option

17 Mar 15:07
Compare
Choose a tag to compare

Version 0.7.2

17 Dec 11:03
Compare
Choose a tag to compare

Version 0.7.1

11 Dec 10:09
Compare
Choose a tag to compare

Version 0.7.0

08 Dec 08:51
Compare
Choose a tag to compare
const api = reduxApi({
   test: {
     url: "/test",
     options: { headers: { "Content-type": "application/json" } }
   }
}).init(....);

api.actions.test.request(null, { headers: { "token": "test-token" } });

Request will be with both headers.
56e6bc2f

Version 0.6.8

12 Nov 06:54
Compare
Choose a tag to compare

Validation is working in request method #20

// rest.js
import reduxApi from "redux-api";
export default reduxApi({
  test: {
    url: "/api/test"
    options: {
      method: "post",
      headers: {
        "Accept": "application/json",
        "Content-type": "application/json"
      }
    },
    virtual: true,
    validation(data, cb) {
      const err = !data ? "Invalid data" : null;
      cb(err, data);
    }
  }
});

.....
import {actions} from "./rest"
actions.test.request().then(...)

art-hrocpb8

Version 0.6.7

12 Nov 06:49
Compare
Choose a tag to compare

Add request method for pure xhr request without redux workflow #18

import {actions} from "./rest";
actions.entries.request().then((data)=> {
  // processing xhr responce
});

Version 0.6.6

12 Nov 06:44
Compare
Choose a tag to compare

Bug fixing 05bd438

Version 0.6.5

12 Nov 06:41
Compare
Choose a tag to compare

Add async helpers #17

{  
  logger: "/api/logger",
  test: {
    url: "/api/test/:name/:id",
    helpers: {
      // complicated async logic
      async() {
        const {dispatch} = this;
        return (cb)=> {
          dispatch(rest.actions.logger((err)=> {
            const args = [{id: 1, name: "admin"}];
            cb(err, args);
          }));
        };
      }
    }
  }
}

Version 0.6.4

12 Nov 06:40
Compare
Choose a tag to compare

Add helpers option #16

{
  test: {
    url: "/api/test/:name/:id",
    helpers: {
      get(id, name) {
        return [{id, name}], {}]
      },
      post(id, name, data) {
        const {uuid} = this.getState().test;
        const urlparams = {id, name};
        const params = {body: {uuid, data}};
        return [urlparams, params];
      }
    }
  }
}
// using helpers
rest.actions.test.get(1, "admin");
// with callback
rest.actions.post(1, "admin", {msg: "Hello"}, (err)=> {
// end of action
});