Project

General

Profile

Actions

Task #940

open

Remove callback from AutomaticRoleAttributeService

Added by Ondřej Kopr about 6 years ago.

Status:
New
Priority:
Normal
Assignee:
Ondřej Kopr
Category:
Frontend
Target version:
-
Start date:
01/31/2018
Due date:
% Done:

0%

Estimated time:
Owner:

Description

In method recalculate (class: AutomaticRoleAttributeService) is defined callback, please move this functionality with callback to manager.

recalculate(id, callback = null) {
    return RestApiService
      .post(this.getApiPath() + '/' + id + REACALCULATE_PATH)
      .then(jsonResponse => {
        if (Utils.Response.hasError(jsonResponse)) {
          throw Utils.Response.getFirstError(jsonResponse);
        }
        if (Utils.Response.hasInfo(jsonResponse)) {
          throw Utils.Response.getFirstInfo(jsonResponse);
        }
        return jsonResponse.json();
      })
      .then(json => {
        if (callback !== null) {
          callback(json);
        }
        return json;
      });
  }

And in _recalculate method (class: AutomaticRoleAttributeDetail) is used receive entity this behavior is possible to add into manager and remove from this place.

this.context.store.dispatch(this.manager.receiveEntity(automaticRole.id, automaticRole));

No data to display

Actions

Also available in: Atom PDF