← back to Dear Bubbe Nextjs

app/callback/page.tsx

34 lines

'use client'
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';

export default function Callback() {
  const router = useRouter();
  
  useEffect(() => {
    // Handle OAuth callback
    const params = new URLSearchParams(window.location.search);
    const code = params.get('code');
    const state = params.get('state');
    
    if (code) {
      // Store the auth code if needed
      localStorage.setItem('twitter_auth_code', code);
    }
    
    // Redirect to home after 2 seconds
    setTimeout(() => {
      router.push('/');
    }, 2000);
  }, [router]);
  
  return (
    <div className="min-h-screen bg-gradient-to-b from-blue-50 to-white flex items-center justify-center">
      <div className="text-center">
        <h1 className="text-2xl font-bold mb-4">Authentication Successful!</h1>
        <p className="text-gray-600">Redirecting you back to Bubbe...</p>
      </div>
    </div>
  );
}