{"size": 832, "ext": "js", "max_stars_repo_path": "src/widgets/TemplatePreview/api/TemplatePreviewApi.js", "max_stars_repo_name": "amitznati/template-editor", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/widgets/TemplatePreview/api/TemplatePreviewApi.js", "max_issues_repo_name": "amitznati/template-editor", "max_issues_repo_issues_event_min_datetime": "2019-12-09T10:05:07.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-09T10:05:07.000Z", "max_forks_repo_path": "src/widgets/TemplatePreview/api/TemplatePreviewApi.js", "max_forks_repo_name": "amitznati/template-editor", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 29.7142857143, "max_line_length": 76, "alphanum_fraction": 0.7259615385}
import BaseApi from '../../../sdk/BaseApi';
import selectors from './TemplatePreviewSelectors';

export const ActionTypes = {
  SET_IS_NODE_REFRESH_REQUIRE: 'SET_IS_NODE_REFRESH_REQUIRE'
};
export default class TemplatePreviewApi extends BaseApi {
  onPathChange = (pathData) => {
    const {
      EditTemplateMainViewApi: { getSelectedLayoutSelector, onUpdateLayout }
    } = this.apis;
    const { selectedLayout } = getSelectedLayoutSelector();
    selectedLayout.properties.pathData = pathData;
    onUpdateLayout(selectedLayout);
  };

  setIsNodeRefreshRequire = (isRequire) => {
    this.dispatchStoreAction({
      type: ActionTypes.SET_IS_NODE_REFRESH_REQUIRE,
      payload: isRequire
    });
  };

  isNodeRefreshRequireSelector = () => {
    return selectors.isNodeRefreshRequireSelector(this.store.getState());
  };
}
