fix: OAuth — window.location.href direct, no cross-origin fetch (CORS)
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 28s

This commit is contained in:
2026-03-15 03:30:49 +01:00
parent 94b607c4d0
commit ef4c23d6a2

View File

@@ -24,18 +24,10 @@ export default function LoginPage() {
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const [oauthLoading, setOauthLoading] = useState<string | null>(null); const [oauthLoading, setOauthLoading] = useState<string | null>(null);
async function handleOAuth(providerId: string) { function handleOAuth(providerId: string) {
if (oauthLoading) return; if (oauthLoading) return;
setOauthLoading(providerId); setOauthLoading(providerId);
try { window.location.href = `${base}/api/v1/oauth/${providerId}?redirectUrl=${redirectUrl}`;
const res = await fetch(`${base}/api/v1/oauth/${providerId}?redirectUrl=${redirectUrl}`);
const data = await res.json() as { success: boolean; data?: { authUrl?: string } };
if (data.data?.authUrl) {
window.location.href = data.data.authUrl;
}
} catch {
setOauthLoading(null);
}
} }
async function handleSubmit(e: React.FormEvent) { async function handleSubmit(e: React.FormEvent) {