Issues with `throw redirect()`
I have a login form and server function:
Why is it not redirecting?
I think I lack of understanding
Also I see this in the console
`Admin login error: Response {options: {…}, type: 'default', url: '', redirected: false, status: 307, …}``
2 Replies
conscious-sapphire•3w ago
You need to use the
useServerFn hook in components to be able to handle redirects.
https://tanstack.com/start/latest/docs/framework/react/guide/server-functions#where-to-call-server-functionsServer Functions | TanStack Start React Docs
What are Server Functions? Server functions let you define server-only logic that can be called from anywhere in your application loaders, components, hooks, or other server functions. They run on the...
like-goldOP•3w ago
Thank you. This works 🙂
Did not see that in the docs.
Can you please explain why it needs to be wrappen in that hook?