results api-key

This commit is contained in:
Owen Rees
2023-10-06 16:41:11 +02:00
parent ac349b9115
commit 594a22602f
6 changed files with 2571 additions and 2 deletions
@@ -118,8 +118,18 @@ export const fetchTournamentResults = publicProcedure
throw new Error("ERR_NO_TOURNAMENT_ID");
}
const headers = new Headers()
const apiKey = process.env.RESULTS_API_KEY
if (apiKey) {
headers.append('api-key', apiKey)
}
const rawResults = await fetch(
`${process.env.RESULTS_SCRAPER_URL}${tournamentId}`,
{
headers: headers
}
);
const results = await rawResults.json();