Passing Cookies with event.$fetch and useRequestFetch in Nuxt

Passing Cookies with event.$fetch and useRequestFetch in Nuxt

Alexander Lichter

54 года назад

2,696 Просмотров

Ever wondered why cookies are not passed correctly to subrequests - e.g. during SSR or when using Nitro/H3? Then this video is for you. Together we have a look how to pass all the important information, including event context and headers to further calls, eliminating different behavior on server and client.

#nuxtjs #nuxt #vue #webdevelopment

---
Links and Resources:

🔗 10% Off for vuejs.de Conf with Code LICHTER https://conf.vuejs.de/tickets/?voucher=LICHTER

🔗 CONTRIBUTE HERE - https://github.com/nuxt/nuxt/issues/19815
🔗 Code https://github.com/manniL/alexander-lichter-nuxt-use-request-fetch
🔗 Sentry Blog Post https://www.lichter.io/articles/nuxt3-sentry-recipe/

📺 Nuxt vs. Nitro https://www.youtube.com/watch?v=DkvgJa-X31k
📺 What is a BFF? https://www.youtube.com/watch?v=Zli-u9kxw0w
📺 @DejaVueFm #E026 - Vue 3.5 Analyzed https://share.transistor.fm/s/15838e9d

---
Chaptermarks

00:00 Intro
00:15 Pass Cookies via API Request?
01:06 Demo App setup
02:05 Creating a "cookies" API endpoint
03:14 Sending cookies to a subrequest on the server side
05:41 Diving into Nitro and h3 internals for event.$fetch
08:53 Do I need to know about it when not using Nitro at all?
09:17 Calling the API from our Nuxt instance via useFetch
11:35 The same but with useAsyncData
11:49 Fixing the issue with useRequestFetch
14:17 Diving into the Nuxt source code
17:23 Wrapping up
Ссылки и html тэги не поддерживаются


Комментарии: