export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const supabase = createServerSupabaseClient(ctx);
const {
data: { session },
} = await supabase.auth.getSession();
if (!session)
return {
notFound: true,
};
const { data: customers, error } = await supabase
.from("customer")
.select("*");
if (error) throw new Error(error.message);
return {
props: {
customers,
},
};
};
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const supabase = createServerSupabaseClient(ctx);
const {
data: { session },
} = await supabase.auth.getSession();
if (!session)
return {
notFound: true,
};
const { data: customers, error } = await supabase
.from("customer")
.select("*");
if (error) throw new Error(error.message);
return {
props: {
customers,
},
};
};