// pages/me.jsx
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import { useSession } from 'next-auth/react';

export default function Me() {
    const router = useRouter();
    const { data: session, status } = useSession();

    useEffect(() => {
        if (status === 'authenticated') {
            router.push(`/cart/publishers/edit/${session.user.id}?self=true`);
        } else if (status === 'unauthenticated') {
            router.push('/api/auth/signin');
        }
    }, [status, session, router]);

    // You can add a fallback content or loader here if you want
    return <div>Redirecting...</div>;
}
