feat: pass invite token through signup flow

This commit is contained in:
Tim
2025-08-17 12:11:13 +08:00
parent 2dd56e27af
commit e0df78deee
18 changed files with 63 additions and 29 deletions

View File

@@ -9,11 +9,12 @@ import { githubExchange } from '~/utils/github'
onMounted(async () => {
const url = new URL(window.location.href)
const code = url.searchParams.get('code')
const state = url.searchParams.get('state')
const result = await githubExchange(code, state, '')
const inviteToken = url.searchParams.get('state')
const result = await githubExchange(code, inviteToken, '')
if (result.needReason) {
navigateTo(`/signup-reason?token=${result.token}`, { replace: true })
const q = inviteToken ? `&invite_token=${inviteToken}` : ''
navigateTo(`/signup-reason?token=${result.token}${q}`, { replace: true })
} else {
navigateTo('/', { replace: true })
}