import axios from "axios"; export interface IJitzHttpClient { get: (url: string, header?: any) => any; post: (url: string, data: any, header?: any) => any; } export default class JitzHttpClient implements IJitzHttpClient { private header: any = { Accept: "application/json;odata=verbose", "Content-Type": "application/json;odata=verbose", }; private _client: any; constructor() { this._client = axios.create({}); } public get = (url: string, header?: any) => { header = header || this.header; var authOptions = { method: "GET", url: url, data: JSON.stringify({}), headers: header, json: true, }; return this._client(authOptions); }; public post = (url: string, data: any, header?: any) => { header = header || this.header; var authOptions = { method: "POST", url: url, data: JSON.stringify(data), headers: header, json: true, }; return this._client(authOptions); }; }