Exelord/ember-custom-actions

View on GitHub
addon/actions/custom.js

Summary

Maintainability
A
2 hrs
Test Coverage
import Action from 'ember-custom-actions/actions/action';
import deepMerge from 'lodash.merge';

export default function(id, options = {}) {
  return function(payload = {}, actionOptions = {}) {
    actionOptions.data = payload;

    return Action.create({
      id,
      model: this,
      integrated: true,
      options: deepMerge({}, options, actionOptions)
    }).callAction();
  };
}