implement general http request function & update existing usage in other files

This commit is contained in:
Michi 2025-09-27 13:11:33 +02:00
parent ebb3191757
commit 6ed53835ff
4 changed files with 46 additions and 19 deletions

View file

@ -1,7 +1,7 @@
import { getDbEnv } from '../db/client'
import { themepark } from '../db/schema'
import { countryCodesDE } from '../lib/countries'
import fetchData from '../lib/fetch-data'
import httpRequest from '../lib/http-request'
import asyncBatchJob from '../lib/async-batch-job'
interface Park {
@ -24,7 +24,9 @@ async function fetchThemeparks(
const headers = {
'language':lang
}
const result = await fetchData<Park[]>(endpoint, headers);
const result = await httpRequest<Park[]>(endpoint, {
headers: headers
});
return result;
}
catch(e){