fix: use event.fetch instead of global fetch for server-side requests
Some checks failed
CI / update (push) Failing after 5s
Some checks failed
CI / update (push) Failing after 5s
Updated both hooks.server.ts and bible-quote API to properly use event.fetch for relative URLs in server-side code, following SvelteKit best practices. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ async function authorization({ event, resolve }) {
|
||||
}
|
||||
|
||||
// Bible verse functionality for error pages
|
||||
async function getRandomVerse(): Promise<any> {
|
||||
async function getRandomVerse(fetch: typeof globalThis.fetch): Promise<any> {
|
||||
try {
|
||||
const response = await fetch('/api/bible-quote');
|
||||
if (!response.ok) {
|
||||
@@ -75,7 +75,7 @@ export const handleError: HandleServerError = async ({ error, event, status, mes
|
||||
console.error('Error occurred:', { error, status, message, url: event.url.pathname });
|
||||
|
||||
// Add Bible verse to error context
|
||||
const bibleQuote = await getRandomVerse();
|
||||
const bibleQuote = await getRandomVerse(event.fetch);
|
||||
|
||||
return {
|
||||
message: message,
|
||||
|
||||
Reference in New Issue
Block a user