auth/local example redirectTo is not working properly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 236
- Forks
- 51
- Avg merge
- 3h 48m
- Merged PRs (30d)
- 5
Description
When testing the auth/local example I noticed that the redirectTo is not working properly, I
figured that the useAuth().redirectTo value gets cleared before being used.
await $fetch("/api/auth/login", {
method: "POST",
body: {
email: email,
password: password,
},
});
useAuth().redirectTo.value = null; // <-- this line
await useAuth().updateSession();
await navigateTo(useAuth().redirectTo.value || "/");
So the null value could maybe be set after the navigateTo call, or can possibly omitted at all, as it gets set from the auth middleware anyway.
Else, great example, thanks for sharing!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the auth/local example and trace the login flow around the shown redirectTo reset, updateSession call, and navigateTo call. Verify that the redirectTo value remains available through session updates and that navigation uses the intended destination; the issue is done when the example redirects correctly after login.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- authentication, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100