mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
fixed server side team invitation
This commit is contained in:
parent
d84b29f5f4
commit
7d4d2c18b6
@ -645,7 +645,7 @@ export class StackClientInterface {
|
||||
email: string,
|
||||
teamId: string,
|
||||
callbackUrl: string,
|
||||
session: InternalSession | null,
|
||||
session: InternalSession,
|
||||
}): Promise<void> {
|
||||
await this.sendClientRequest(
|
||||
"/team-invitations/send-code",
|
||||
|
||||
@ -502,4 +502,26 @@ export class StackServerInterface extends StackClientInterface {
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
async sendServerTeamInvitation(options: {
|
||||
email: string,
|
||||
teamId: string,
|
||||
callbackUrl: string,
|
||||
}): Promise<void> {
|
||||
await this.sendServerRequest(
|
||||
"/team-invitations/send-code",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email: options.email,
|
||||
team_id: options.teamId,
|
||||
callback_url: options.callbackUrl,
|
||||
}),
|
||||
},
|
||||
null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1967,10 +1967,9 @@ class _StackServerAppImpl<HasTokenStore extends boolean, ProjectId extends strin
|
||||
throw new Error("Cannot invite user without a callback URL from the server. Make sure you pass the `callbackUrl` option: `inviteUser({ email, callbackUrl: ... })`");
|
||||
}
|
||||
|
||||
await app._interface.sendTeamInvitation({
|
||||
await app._interface.sendServerTeamInvitation({
|
||||
teamId: crud.id,
|
||||
email: options.email,
|
||||
session: null,
|
||||
callbackUrl: options.callbackUrl ?? constructRedirectUrl(app.urls.teamInvitation),
|
||||
});
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user