File tree Expand file tree Collapse file tree
supabase/functions/send-email-for-new-chat-message Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { siteConfig } from "@/config/site" ;
22import Link from "next/link" ;
3+ import { cookies } from "next/headers" ;
34import PeelsLogo from "@/components/PeelsLogo" ;
45import LocalePicker from "@/components/LocalePicker" ;
5- import { createClient } from "@/utils/supabase/server" ;
66import { styled } from "@pigment-css/react" ;
77import { getTranslations } from "next-intl/server" ;
88
99const currentYear = new Date ( ) . getFullYear ( ) ;
1010
1111export default async function LegalFooter ( ) {
1212 const t = await getTranslations ( ) ;
13- const supabase = await createClient ( ) ;
14- const {
15- data : { user } ,
16- } = await supabase . auth . getUser ( ) ;
13+ const cookieStore = await cookies ( ) ;
14+ const hasSupabaseAuthCookie = cookieStore
15+ . getAll ( )
16+ . some ( ( { name } ) => name . includes ( "auth-token" ) ) ;
1717
1818 return (
1919 < StyledFooter >
@@ -22,7 +22,7 @@ export default async function LegalFooter() {
2222 © { currentYear } { siteConfig . name }
2323 </ p >
2424
25- { ! user && < LocalePicker compact = { true } /> }
25+ { ! hasSupabaseAuthCookie && < LocalePicker compact = { true } /> }
2626
2727 < StyledNav >
2828 < Link href = { siteConfig . links . about } > { t ( "App.about" ) } </ Link >
Original file line number Diff line number Diff line change @@ -138,6 +138,10 @@ const handler = async (_request: Request): Promise<Response> => {
138138 const recipientEmail = recipientData ?. user ?. email ;
139139 console . log ( "Recipient Email:" , recipientEmail ) ;
140140
141+ if ( ! recipientEmail ) {
142+ throw new Error ( `No email found for recipient ${ recipientId } ` ) ;
143+ }
144+
141145 const { data : recipientProfile } = await supabase
142146 . from ( "profiles" )
143147 . select ( "preferred_locale" )
You can’t perform that action at this time.
0 commit comments