Wauplin's picture
Wauplin HF Staff
much much better
e92d5c0 verified
raw
history blame
419 Bytes
import { BACKEND_URL } from "../config/constants";
export async function apiFetch(
endpoint: string,
options: RequestInit = {},
): Promise<Response> {
const url = `${BACKEND_URL}${endpoint}`;
const defaultOptions: RequestInit = {
credentials: "include",
headers: {
"Content-Type": "application/json",
...options.headers,
},
...options,
};
return fetch(url, defaultOptions);
}