Chore: update also last example on the page (#32809)

This commit is contained in:
Rodrigo Mansueli authored and GitHub committed 2025-01-16 06:28:41 +11:00
1 parent 3e94bc483c
commit f233c78794
1 file changed
+6 -4
+6 -4
View File
@@ -71,11 +71,13 @@ Deno.serve(async (req: Request) => {
const supabaseClient = createClient(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
{ global: { headers: { Authorization: req.headers.get('Authorization')! } } }
)
);
// Database queries will have RLS policies enforced
const { data, error } = await supabaseClient.from('profiles').select('*')
// Get the session or user object
const authHeader = req.headers.get('Authorization')!;
const token = authHeader.replace('Bearer ', '');
const { data: userData } = await supabaseClient.auth.getUser(token);
const { data, error } = await supabaseClient.from('profiles').select('*');
return new Response(JSON.stringify({ data }), {
headers: { 'Content-Type': 'application/json' },