src/entity/Action.js
/**
   * Return overridden resource factory for Actions. Actions require an
   * action type to be specified before the ID. The action creation is also
   * different from any other Resource, as it fetches the user location and
   * pre-populates the action payload with the Resource type.
   *
   * @static
   * @return {{action: Function}}
   */
Return overridden resource factory for Actions. Actions require an
action type to be specified before the ID. The action creation is also
different from any other Resource, as it fetches the user location and
pre-populates the action payload with the Resource type.

@static
@return {{action: Function}}
Return overridden resource factory for Actions . Actions require an action type to be specified before the ID . The action creation is also different from any other Resource as it fetches the user location and pre - populates the action payload with the Resource type . @static @return {{ action : Function }}
static resourceFactory () {
    return {
      action (actionType, id) {
        if (!actionType) {
          throw new TypeError('Action type cannot be empty.')
        }
        if (!isString(actionType)) {
          throw new TypeError('Action type must be a name string')
        }
        const relativePath = path.replace(':type', actionType)
        const context = this
        return Object.assign(Resource.factoryFor(Action, relativePath).call(this, id), {
          create (...args) {
            return createAction.call(this, context, actionType, ...args)
          }
        })
      }
    }
  }
static resourceFactory ( ) { return { action ( actionType , id ) { if ( ! actionType ) { throw new TypeError ( 'Action type cannot be empty.' ) } if ( ! isString ( actionType ) ) { throw new TypeError ( 'Action type must be a name string' ) } const relativePath = path . replace ( ':type' , actionType ) const context = this return Object . assign ( Resource . factoryFor ( Action , relativePath ) . call ( this , id ) , { create ( ... args ) { return createAction . call ( this , context , actionType , ... args ) } } ) } } }
Return overridden resource factory for Actions.
Return overridden resource factory for Actions .
// Creates and returns Resource of type Action. // Override property resource create to allow custom value params and // fetch the user's geolocation. See `createAction()`.