sendRedirect not redirecting to page in ssr
Hey I have a nuxt 3 SSR project and have a server
POST
api route /api/login
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:
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
Nuxt - Starter - StackBlitz
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
1 Reply
For anyone that comes across this thread:
https://github.com/nuxt/nuxt/issues/21334
GitHub
Server sendRedirect not routing client · Issue #21334 · nuxt/nuxt
Environment Operating System: Darwin Node Version: v18.16.0 Nuxt Version: 3.5.2 Nitro Version: 2.4.1 Package Manager: [email protected] Builder: vite User Config: ssr, css, devServer, postcss, modules, ve...