import prisma from '@/lib/prisma';
import { getServerSession } from 'next-auth';
import { redirect } from 'next/navigation';

// This component should never render
export default async function NoWorkspace() {
	const session = await getServerSession();
	const workspace = await prisma.workspace.findFirst({
		where: {
			ownerId: session?.user.id as string,
		},
	});

	if (workspace) {
		redirect(`/${workspace.slug}`);
	}

	return <div>You don&apos;t </div>;
}
