2024-09-10 06:16:41 +00:00
|
|
|
import { ZOEKT_WEBSERVER_URL } from "../environment"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface ZoektRequest {
|
|
|
|
|
path: string,
|
|
|
|
|
body: string,
|
|
|
|
|
method: string,
|
2024-09-11 19:15:12 +00:00
|
|
|
cache?: RequestCache,
|
2024-09-10 06:16:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const zoektFetch = async ({
|
|
|
|
|
path,
|
|
|
|
|
body,
|
|
|
|
|
method,
|
2024-09-11 19:15:12 +00:00
|
|
|
cache,
|
2024-09-10 06:16:41 +00:00
|
|
|
}: ZoektRequest) => {
|
|
|
|
|
const response = await fetch(
|
|
|
|
|
new URL(path, ZOEKT_WEBSERVER_URL),
|
|
|
|
|
{
|
|
|
|
|
method,
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
},
|
|
|
|
|
body,
|
2024-09-11 19:15:12 +00:00
|
|
|
cache,
|
2024-09-10 06:16:41 +00:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// @todo : add metrics
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
}
|