add sign in redirect path (#5746)

This commit is contained in:
Prospector
2026-04-04 13:33:09 -07:00
committed by GitHub
parent 54c45ac9f3
commit c4b3c6e8d6
9 changed files with 55 additions and 17 deletions

View File

@@ -2,8 +2,11 @@ import type { Labrinth } from '@modrinth/api-client'
import { type AuthProvider, provideAuth } from '@modrinth/ui'
import { ref, watchEffect } from 'vue'
import { getSignInRedirectPath } from '~/composables/auth.js'
export function setupAuthProvider(auth: Awaited<ReturnType<typeof useAuth>>) {
const router = useRouter()
const route = useRoute()
const sessionToken = ref<string | null>(null)
const user = ref<Labrinth.Users.v2.User | null>(null)
@@ -14,7 +17,7 @@ export function setupAuthProvider(auth: Awaited<ReturnType<typeof useAuth>>) {
await router.push({
path: '/auth/sign-in',
query: {
redirect: redirectPath,
redirect: redirectPath || getSignInRedirectPath(route),
},
})
},