lucia-auth / examples

A collection of example projects built with Lucia
MIT License
226 stars 52 forks source link

fix(nuxt): use `$fetch` and `event.$fetch` for requests #26

Closed danielroe closed 7 months ago

danielroe commented 7 months ago

Some slight refactors to avoid using useFetch to perform fetches. (It's a composable that should only be called in Nuxt plugins or component setup functions.)

pilcrowOnPaper commented 7 months ago

So useRequestFetch() returns a fetch() with the current request context? Just to make sure, it doesn't return undefined in non-SSR context like useRequestEvent(), right?

danielroe commented 7 months ago

Yes. Exactly.

https://github.com/nuxt/nuxt/blob/73421483f60fd25d57e22b4c49e4b111745692cb/packages/nuxt/src/app/composables/ssr.ts#L39-L44

pilcrowOnPaper commented 7 months ago

Thanks!