don't append empty path to redirect

This commit is contained in:
Gauthier Roebroeck 2025-08-06 14:11:48 +08:00
parent d33c0a3eb7
commit 11287818bd

View file

@ -10,7 +10,11 @@ export function useLoginGuard(router: Router) {
const { data } = useCurrentUser()
const authenticated = data.value
if (!authenticated) {
const query = Object.assign({}, to.query, { redirect: to.fullPath })
const query = Object.assign(
{},
to.query,
to.fullPath !== '/' ? { redirect: to.fullPath } : {},
)
return { name: '/startup', query: query }
}
}