-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa4b6c0
commit 6ddf8e3
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { PageLoad } from './$types' | ||
import { wrapFetch } from './wrap-fetch' | ||
|
||
export const load: PageLoad = async ({ fetch }) => ({ | ||
fetch: wrapFetch('calling from +page.ts', fetch), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** This utility helps to demonstrate that a custom implementation for fetch (first supplied by sveltekit then passed to Connect) is actually being called. */ | ||
export const wrapFetch = ( | ||
message: string, | ||
fetch: typeof globalThis.fetch, | ||
) => ( | ||
url: RequestInfo | URL, | ||
init?: RequestInit | undefined, | ||
) => { | ||
console.log(message) | ||
return fetch(url, init) | ||
} |