File size: 412 Bytes
830bf88 e92d5c0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import { BACKEND_URL } from "../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);
}
|