36 lines
849 B
TypeScript
36 lines
849 B
TypeScript
import Generator from '@/components/dashboard/ai-generator';
|
|
import { Providers } from '@/components/providers';
|
|
import {
|
|
getProducts,
|
|
getSubscription,
|
|
getUser,
|
|
getUserDetails
|
|
} from '@/utils/supabase/queries';
|
|
import { createClient } from '@/utils/supabase/server';
|
|
import { redirect } from 'next/navigation';
|
|
|
|
export default async function AiGenerator() {
|
|
const supabase = createClient();
|
|
const [user, userDetails, products, subscription] = await Promise.all([
|
|
getUser(supabase),
|
|
getUserDetails(supabase),
|
|
getProducts(supabase),
|
|
getSubscription(supabase)
|
|
]);
|
|
|
|
if (!user) {
|
|
return redirect('/dashboard/signin');
|
|
}
|
|
|
|
return (
|
|
<Providers>
|
|
<Generator
|
|
userDetails={userDetails}
|
|
user={user}
|
|
products={products}
|
|
subscription={subscription}
|
|
/>
|
|
</Providers>
|
|
);
|
|
}
|