Home Identifier Source Repository

lib/utilities/APIProxy.js

  1. "use strict";
  2.  
  3. export default function(actions, store) {
  4. let wrapper = Object.create({}, {
  5. store: {
  6. get: () => store
  7. }
  8. });
  9.  
  10. actions.apiMethods.forEach(method => {
  11. Object.defineProperty(wrapper, method, {
  12. value: (...args) => {
  13. return actions[method].call(actions, ...args);
  14. }
  15. });
  16. });
  17.  
  18. return wrapper;
  19. }