Skip to content
Discussion options

You must be logged in to vote

Hey @Thomanidas! Thanks for your question. The sanctum:redirect hook is not supposed to be used to override the endpoint of the redirect.

In your case, since it is mostly related to the logic of your app, I'd recommend disabling the default redirect and handling it according to your needs.

To disable the default redirect, adjust nuxt.config.ts like this:

sanctum: {
    redirect: {
      onLogin: false,
    },
  },

Now you can define any redirect logic close to your login functionality, and it won't fail with "must be called at the top of a setup function" because it will be inside of setup function context. Let me know if you need help with applying this to your login component.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by manchenkoff
Comment options

You must be logged in to vote
1 reply
@manchenkoff
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants