Skip to content

Commit 8873841

Browse files
committed
feat(types,clerk-js): Introduce UserOrganizationInvitation.accept()
1 parent 89bc5de commit 8873841

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.changeset/green-rocks-refuse.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Introduces the accept method in UserOrganizationInvitation class

packages/clerk-js/src/core/resources/UserOrganizationInvitation.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export class UserOrganizationInvitation extends BaseResource implements UserOrga
4848
super();
4949
this.fromJSON(data);
5050
}
51+
52+
accept = async (): Promise<UserOrganizationInvitation> => {
53+
return await this._basePost({
54+
path: `/me/organization_invitations/${this.id}/accept`,
55+
});
56+
};
57+
5158
protected fromJSON(data: UserOrganizationInvitationJSON | null): this {
5259
if (data) {
5360
this.id = data.id;

packages/types/src/userOrganizationInvitation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ export interface UserOrganizationInvitationResource extends ClerkResource {
2727
status: OrganizationInvitationStatus;
2828
createdAt: Date;
2929
updatedAt: Date;
30+
accept: () => Promise<UserOrganizationInvitationResource>;
3031
}

0 commit comments

Comments
 (0)