Trey
02/09/2023, 6:59 PMgaryaustin
02/09/2023, 7:01 PMsilentworks
02/09/2023, 7:11 PMgaryaustin
02/09/2023, 7:23 PMsilentworks
02/09/2023, 7:26 PMDYELbrah
02/11/2023, 4:55 AM\ ឵឵឵
02/11/2023, 4:51 PMgaryaustin
02/11/2023, 4:58 PMDYELbrah
02/12/2023, 4:38 AMexport 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,
},
};
};
Is there a way I can avoid having to duplicate the portion:
const supabase = createServerSupabaseClient(ctx);
const {
data: { session },
} = await supabase.auth.getSession();
if (!session)
return {
notFound: true,
};
every single time I want to check for a session?Ellis
02/12/2023, 8:26 AMmadjar
02/12/2023, 5:12 PMShannon Code (emblem vault)
02/12/2023, 6:30 PMShannon Code (emblem vault)
02/12/2023, 6:30 PMgaryaustin
02/12/2023, 7:03 PMShannon Code (emblem vault)
02/12/2023, 7:04 PMgaryaustin
02/12/2023, 7:05 PMShannon Code (emblem vault)
02/12/2023, 7:10 PMShannon Code (emblem vault)
02/12/2023, 7:10 PMShannon Code (emblem vault)
02/12/2023, 7:11 PMgaryaustin
02/12/2023, 7:16 PMXolify
02/12/2023, 8:23 PMUnknown Member
02/12/2023, 9:06 PMUnknown Member
02/12/2023, 9:06 PMwell
02/12/2023, 10:01 PM水瓶座ーcindrmon
02/13/2023, 5:04 AMMarcoSantonastasi
02/13/2023, 2:20 PMpid1
02/13/2023, 8:07 PMMarcoSantonastasi
02/13/2023, 9:53 PMMarcoSantonastasi
02/13/2023, 9:54 PMwell
02/13/2023, 9:56 PM