Component Actioncycle

All two-way-rest components have the same actioncycle that can be tapped into by declaring function using the prop of the appropriate name

callforward--> defaultAction--> onSuccessCB || onFailureCB--> callback

These functions are wrapped in bluebird's Promise.Method, so they accept promises. They take a single parameter, args, which is an immutable Map object (from immutableJS), and must return an args Map with the same properties.

example:

<TWRCreate tree='users' onSuccessCB={args=>{
const response = args.get('response);
console.log('response', response)
return args
}} />

The args Map:

  • reducer: name of reducer
  • tree: frontend/backend location of instance
  • outTree: the frontend location for the response from the backend (defaults to tree)
  • path: remote url suffix (defaults to tree) + this.props.endPath
  • endPath rest action like edit, show, etc.
  • form: the entire component element
  • content: this.props.content object
  • callforward:
  • callback:
  • onSuccessCB:
  • onFailureCB:
  • upload: is one of the fields in the component a file field
  • force: should a component refire its standard ajax call everytime it is updated
  • parent: true for CreateChildComponents
  • id: declared using this.props.id, forces a create component to use the declared id
  • twr: the component itself
  • response: if declared using this.props.response, skips ajax call and returns response
  • dispatch: disptach function
  • getState: getState function
  • batchDispatch: the actual dispatch function

results matching ""

    No results matching ""