fix(auth): return to origin path after GitHub login

Sign-in saves the current path in sessionStorage so the OAuth callback
can route back instead of always landing on Home.
This commit is contained in:
Julien Calixte
2026-05-29 16:49:44 +02:00
parent a09e541fa8
commit d99672dbd8
3 changed files with 30 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import { onBeforeMount, ref } from "vue"
import { useRoute, useRouter } from "vue-router"
import { useGitHubLogin } from "@/hooks/useGitHubLogin.hook"
import { consumeGithubOAuthReturnPath } from "@/modules/user/service/oauthReturnPath"
import { signIn } from "@/modules/user/service/signIn"
const route = useRoute()
@@ -22,7 +23,13 @@ onBeforeMount(async () => {
await saveCredentials(token)
}
router.replace({ name: "Home" })
const returnPath = consumeGithubOAuthReturnPath()
if (!hasError.value && returnPath) {
router.replace(returnPath)
} else {
router.replace({ name: "Home" })
}
}
})
</script>