fix: guard against null data.user in invite-admin-user Edge Function
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,13 @@ Deno.serve(async (req) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data?.user) {
|
||||||
|
return new Response(JSON.stringify({ error: 'Invite sent but user data unavailable' }), {
|
||||||
|
status: 500,
|
||||||
|
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({ id: data.user.id, email: data.user.email }),
|
JSON.stringify({ id: data.user.id, email: data.user.email }),
|
||||||
{ headers: { ...corsHeaders, 'Content-Type': 'application/json' } },
|
{ headers: { ...corsHeaders, 'Content-Type': 'application/json' } },
|
||||||
|
|||||||
Reference in New Issue
Block a user