From c6268bf167e1a35ad29ab899f4e8acfda1c4209e Mon Sep 17 00:00:00 2001 From: anonymousratwastaken <108170934+anonymousratwastaken@users.noreply.github.com> Date: Fri, 19 Dec 2025 15:37:39 +0000 Subject: [PATCH] again --- src/app/auth/callback/page.tsx | 139 --------------------------------- 1 file changed, 139 deletions(-) delete mode 100644 src/app/auth/callback/page.tsx diff --git a/src/app/auth/callback/page.tsx b/src/app/auth/callback/page.tsx deleted file mode 100644 index 10b8ed0..0000000 --- a/src/app/auth/callback/page.tsx +++ /dev/null @@ -1,139 +0,0 @@ -'use client' - -import { useEffect, useState } from 'react' -import { useRouter, useSearchParams } from 'next/navigation' -import { Loader2 } from 'lucide-react' - -export default function AuthCallback() { - const router = useRouter() - const searchParams = useSearchParams() - const [status, setStatus] = useState<'loading' | 'success' | 'error'>('loading') - const [error, setError] = useState('') - - useEffect(() => { - const handleCallback = async () => { - try { - const code = searchParams.get('code') - const error = searchParams.get('error') - const errorDescription = searchParams.get('error_description') - - if (error) { - setError(errorDescription || error) - setStatus('error') - return - } - - if (!code) { - setError('No authorization code received') - setStatus('error') - return - } - - // Exchange the authorization code for tokens - const response = await fetch('/api/auth/callback', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ code }), - }) - - if (!response.ok) { - const errorData = await response.json() - throw new Error(errorData.error || 'Authentication failed') - } - - const data = await response.json() - - // Store the session/token as needed - if (data.redirect) { - window.location.href = data.redirect - } else { - // Default redirect to dashboard or home - router.push('/') - } - - setStatus('success') - } catch (err) { - setError(err instanceof Error ? err.message : 'Authentication failed') - setStatus('error') - } - } - - handleCallback() - }, [searchParams, router]) - - if (status === 'loading') { - return ( -
-
- -

Completing authentication...

-
-
- ) - } - - if (status === 'error') { - return ( -
-
-
- - - -
-

Authentication Failed

-

{error}

-
- - -
-
-
- ) - } - - return ( -
-
-
- - - -
-

Authentication successful! Redirecting...

-
-
- ) -}