Nin
06/19/2022, 9:30 PMsupabaseClient.auth.api.inviteUserByEmail('john.doe@example.com', {data: {first_name: 'John'}})
Needle
06/19/2022, 9:30 PMsilentworks
06/19/2022, 9:32 PMsilentworks
06/19/2022, 9:32 PMNin
06/19/2022, 9:33 PMsilentworks
06/19/2022, 9:33 PMNin
06/19/2022, 9:34 PMconst sendInvite = payload.invites.map((invite: any)=> supabaseClient.auth.api.inviteUserByEmail(invite.invite_email, {data: {first_name: 'John'}}))
await Promise.all(sendInvite).then(console.log).catch(err => new Error('Failed to invite user'))
silentworks
06/19/2022, 9:38 PMuser_metadata
object it in with the additional data. Also you might want to write that function differently because a error might be returned instead of data, your .catch
won't catch this error at all because you need to check if the error object that is returned from the inviteUserByEmail
function is empty manually.Nin
06/19/2022, 9:40 PM{
data: {
id: "595a3bde-04bb-42e3-9d8d-a3faa5b435cf",
aud: "authenticated",
role: "authenticated",
email: "john.doe@example.com",
invited_at: "2022-06-19T21:37:29.452563112Z",
phone: "",
confirmation_sent_at: "2022-06-19T21:37:29.452563112Z",
app_metadata: { provider: "email", providers: [Array] },
user_metadata: {},
identities: [],
created_at: "2022-06-19T15:36:01.975444Z",
updated_at: "2022-06-19T21:37:29.454257Z"
},
error: null
}
Nin
06/19/2022, 9:40 PMsilentworks
06/19/2022, 9:43 PMNin
06/19/2022, 9:46 PMsilentworks
06/19/2022, 9:47 PMNin
06/19/2022, 9:47 PMsilentworks
06/19/2022, 9:47 PMsilentworks
06/19/2022, 9:48 PMsupabaseClient
?Nin
06/19/2022, 9:48 PMNin
06/19/2022, 9:48 PMNin
06/19/2022, 9:48 PMsilentworks
06/19/2022, 9:48 PMNin
06/19/2022, 9:49 PMsilentworks
06/19/2022, 9:49 PMNin
06/19/2022, 9:49 PMsilentworks
06/19/2022, 9:50 PMsilentworks
06/19/2022, 9:50 PMNin
06/19/2022, 9:50 PMNin
06/19/2022, 9:51 PMNin
06/19/2022, 9:51 PMsilentworks
06/19/2022, 9:52 PMNin
06/19/2022, 9:52 PMsilentworks
06/19/2022, 9:53 PMNin
06/19/2022, 9:54 PMNin
06/19/2022, 9:54 PMNin
06/19/2022, 9:54 PMsilentworks
06/19/2022, 9:54 PMNeedle
06/19/2022, 9:54 PM