123456789101112131415161718192021222324252627282930313233343536373839404142 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- export default class AjaxService {
- constructor(options) {
- this.ajaxService = options.glassContext.getCoreSvc('.Ajax');
- }
- getData = (url, data) => {
- const options = {
- type: 'GET',
- url: url,
- data: data,
- dataType: 'json'
- };
- return this.doAjax(options);
- }
- postData = (url, data) => {
- const options = {
- type: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- url: url,
- data: JSON.stringify(data)
- };
- return this.doAjax(options);
- }
- doAjax = (options) => {
- return this.ajaxService.ajax(options);
- }
- }
|