import axios from 'axios' import { wrapper } from 'axios-cookiejar-support'; import { cookieJar } from './cookie'; // Wrap the existing HttpService of NestJS which internally uses Axios. // Then set withCredentials and cookieJar to make sure cookies are handled. const client = wrapper(axios.create({ withCredentials: true, jar: cookieJar, })) export function request_get(url, params, headers) { return client.get(url, { params, headers, withCredentials: true }) } export function request_post({ url, params, headers, data }) { return client.post(url, data, { params, headers, withCredentials: true}) }