import { IS_NODE } from "@putkoff/abstract-logger"; import { httpBrowser } from "./adapters/httpBrowser"; import { httpServer } from "./adapters/httpServer"; function selectClient() { return IS_NODE ? httpServer : httpBrowser; } export function makeRequest(method: string) { return async function ( url: string, body?: any, opts: any = {} ): Promise { const client = selectClient(); // ⬅️ IMPORTANT: DO NOT CALL client() — TS forbids that. const response = await client(method, url, body, opts); return response.data as T; }; } export const get = makeRequest("GET"); export const post = makeRequest("POST"); export const put = makeRequest("PUT"); export const del = makeRequest("DELETE"); export const http = { get, post, put, del }; export * from "./shared"; export * from "./secure_utils";