diff --git a/docs/content/1.getting-started/6.data-fetching.md b/docs/content/1.getting-started/6.data-fetching.md index 93c1f23484b..ffde5f7279a 100644 --- a/docs/content/1.getting-started/6.data-fetching.md +++ b/docs/content/1.getting-started/6.data-fetching.md @@ -238,9 +238,8 @@ The example below adds the request headers to an isomorphic `$fetch` call to ens ```vue ``` @@ -262,11 +261,11 @@ Here is a list of common headers that are NOT to be proxied: If you want to pass on/proxy cookies in the other direction, from an internal request back to the client, you will need to handle this yourself. ```ts [composables/fetch.ts] -export const fetchWithCookie = async (url: string) => { +export const fetchWithCookie = async (event: H3Event, url: string) => { const res = await $fetch.raw(url) const cookies = (res.headers.get('set-cookie') || '').split(',') for (const cookie of cookies) { - appendHeader(useRequestEvent(), 'set-cookie', cookie) + appendHeader(event, 'set-cookie', cookie) } return res._data } @@ -275,7 +274,8 @@ export const fetchWithCookie = async (url: string) => { ```vue ```