'use client'; import { useEffect, useState } from 'react'; import { getOAuthClient } from '@/lib/atproto-oauth'; export default function OAuthCallback() { const [error, setError] = useState(null); useEffect(() => { getOAuthClient() .then((client) => client.init()) .then((result) => { const returnUrl = result?.state ?? '/blog'; window.location.replace(returnUrl); }) .catch((err) => { setError(err instanceof Error ? err.message : 'Login failed'); }); }, []); if (error) { return (

Login Failed

{error}

Back to blog
); } return (

Completing login...

); }