all files / addon/actions/ custom.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17      10×   10×                  
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();
  };
}