import Resource from "../services/resource" ; import HttpClientException from "../httpClient/httpClientException" ; import ApiException from "../services/exception/apiException" ; import { IRequest } from "../typings/requestOptions" ; async function getJsonResponse < T > ( resource , jsonRequest , requestOptions ? ) ; async function getJsonResponse < T , R > ( resource , jsonRequest , requestOptions ? ) ; async function getJsonResponse < T , R > ( resource , jsonRequest , requestOptions = { } ) { const request = typeof jsonRequest === "string" ? jsonRequest : JSON . stringify ( jsonRequest ) ; const response = await resource . request ( request , requestOptions ) ; try { return typeof response === "string" ? JSON . parse ( response ) : response ; } catch ( e ) { return response ; } } export default getJsonResponse ;