import axios, { AxiosInstance } from 'axios'; export class HttpRequestService { private client: AxiosInstance; constructor(private baseURL?: string, private headers?: any) { this.client = axios.create({ baseURL, headers, }); } async get(url: string, params?: any) : Promise { try { const resp = await this.client.get(url, params); return resp.data; } catch (e) { console.log('http.service get error', e); // eslint-disable-line throw e; } } async post(url: string, body: any) : Promise { try { const resp = await this.client.post(url, body); return resp.data; } catch (e) { console.log('http.service post error', e); // eslint-disable-line throw e; } } }