Fixing issues with action mixin

This commit is contained in:
Bruno Alves de Faria 2017-06-02 10:28:20 -03:00 committed by Erik Ziegler
parent 56c3d0f1dd
commit f33702541c

View File

@ -39,12 +39,12 @@ OHIF.mixins.action = new OHIF.Mixin({
// Get the current component's API
const api = component.getApi();
if (!api || !action || typeof api[action] !== 'function') {
// Stop here if no API or action was defined
return true;
} else if (typeof action === 'function') {
if (typeof action === 'function') {
// Call the action if it's a function
component.actionResult = action.call(event.currentTarget, params);
} else if (!api || !action || typeof api[action] !== 'function') {
// Stop here if no API or action was defined
return true;
} else {
// Call the defined action function
component.actionResult = api[action].call(event.currentTarget, params);