sendRedirect not redirecting to page in ssr
Hey I have a nuxt 3 SSR project and have a server
In my actual project there are a bunch of network requests that are run in the eventHandler (csrf, login, session) when useFetch('api/login') is called via client. Where my problem sits is with the last call in this file:
I would expect my frontend to route to this page but it doesn't. Only after refreshing is my user in a "logged in state" I thought maybe my auth/session managment had a bug but I recreated a minimmal repo in stackblitz and the problem persist there without the auth/session managment.
https://stackblitz.com/edit/github-rsjc9z?file=server%2Fapi%2Flogin.post.ts
I'm new to SSR and nuxt so maybe there's something I've missed. Thanks for any help.
POST api route /api/loginIn my actual project there are a bunch of network requests that are run in the eventHandler (csrf, login, session) when useFetch('api/login') is called via client. Where my problem sits is with the last call in this file:
sendRedirect(event, '/listing/create')I would expect my frontend to route to this page but it doesn't. Only after refreshing is my user in a "logged in state" I thought maybe my auth/session managment had a bug but I recreated a minimmal repo in stackblitz and the problem persist there without the auth/session managment.
https://stackblitz.com/edit/github-rsjc9z?file=server%2Fapi%2Flogin.post.ts
I'm new to SSR and nuxt so maybe there's something I've missed. Thanks for any help.
StackBlitz
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.