mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-01 16:29:29 +00:00
Merge pull request #3560 from StarryKira/feat/issue-3557-oauth-email
feat: fix OAuth email completion flow
This commit is contained in:
@@ -152,6 +152,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { useClipboard } from '@/composables/useClipboard'
|
||||
import { useAppStore, useAuthStore } from '@/stores'
|
||||
import { apiClient } from '@/api/client'
|
||||
import { buildApiUrl } from '@/api/url'
|
||||
import {
|
||||
exchangePendingOAuthCompletion,
|
||||
persistOAuthTokenContext,
|
||||
@@ -256,8 +257,6 @@ function readPendingEmailOAuthProvider(): 'github' | 'google' | null {
|
||||
|
||||
function redirectProviderCallbackToBackend(provider: 'github' | 'google'): void {
|
||||
if (typeof window === 'undefined') return
|
||||
const apiBase = (import.meta.env.VITE_API_BASE_URL as string | undefined) || '/api/v1'
|
||||
const normalized = apiBase.replace(/\/$/, '')
|
||||
const params = new URLSearchParams()
|
||||
for (const [key, value] of Object.entries(route.query)) {
|
||||
if (Array.isArray(value)) {
|
||||
@@ -269,7 +268,7 @@ function redirectProviderCallbackToBackend(provider: 'github' | 'google'): void
|
||||
}
|
||||
}
|
||||
const suffix = params.toString() ? `?${params.toString()}` : ''
|
||||
window.location.href = `${normalized}/auth/oauth/${provider}/callback${suffix}`
|
||||
window.location.href = buildApiUrl(`/auth/oauth/${provider}/callback${suffix}`)
|
||||
}
|
||||
|
||||
async function finalizeTokenResponse(tokenResponse: OAuthTokenResponse, redirect: string) {
|
||||
|
||||
Reference in New Issue
Block a user