a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

use getIdentityData in addDomainPath

+3 -15
+3 -15
actions/domains/addDomainPath.ts
··· 2 2 import { cookies } from "next/headers"; 3 3 import { Database } from "supabase/database.types"; 4 4 import { createServerClient } from "@supabase/ssr"; 5 + import { getIdentityData } from "actions/getIdentityData"; 5 6 6 7 let supabase = createServerClient<Database>( 7 8 process.env.NEXT_PUBLIC_SUPABASE_API_URL as string, ··· 19 20 edit_permission_token: string; 20 21 route: string; 21 22 }) { 22 - let auth_token = (await cookies()).get("auth_token")?.value; 23 - if (!auth_token) return null; 24 - let { data: auth_data } = await supabase 25 - .from("email_auth_tokens") 26 - .select( 27 - `*, 28 - identities( 29 - *, 30 - custom_domains(*) 31 - )`, 32 - ) 33 - .eq("id", auth_token) 34 - .eq("confirmed", true) 35 - .single(); 23 + let auth_data = await getIdentityData(); 36 24 if ( 37 25 !auth_data || 38 26 !auth_data.email || 39 - !auth_data.identities?.custom_domains.find((d) => d.domain === domain) 27 + !auth_data.custom_domains.find((d) => d.domain === domain) 40 28 ) 41 29 return null; 42 30