SmartsRecommenderService.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: Dashboard
  6. *| (C) Copyright IBM Corp. 2017, 2020
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (Class) {
  13. 'use strict';
  14. var SmartsRecommenderService = Class.extend({
  15. init: function init(options) {
  16. SmartsRecommenderService.inherited('init', this, arguments);
  17. this.ajaxSvc = options.ajaxSvc;
  18. this.logger = options.logger;
  19. },
  20. destroy: function destroy() {
  21. this.ajaxSvc = null;
  22. this.logger = null;
  23. },
  24. _executeRequest: function _executeRequest(data, requestURL) {
  25. var querySpec = JSON.stringify(data);
  26. var requestPayload = {
  27. type: 'POST',
  28. headers: {
  29. 'Content-Type': 'application/json'
  30. },
  31. data: querySpec,
  32. processData: false,
  33. url: requestURL
  34. };
  35. return this.ajaxSvc.ajax(requestPayload).then(function (ajaxResponse) {
  36. return Promise.resolve(ajaxResponse);
  37. });
  38. }
  39. });
  40. return SmartsRecommenderService;
  41. });
  42. //# sourceMappingURL=SmartsRecommenderService.js.map