Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 469
chore(clerk-js): Fix broken Organization methods#1871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@clerk/clerk-js': patch | ||
| '@clerk/clerk-react': patch | ||
| '@clerk/types': patch | ||
| --- | ||
| Fix methods in clerk-js that consumede paginated endpoints in order to retrieve single resources. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -342,18 +342,19 @@ export class Organization extends BaseResource implements OrganizationResource { | ||
| public async reload(params?: ClerkResourceReloadParams): Promise<this> { | ||
| const { rotatingTokenNonce } = params || {}; | ||
| const json = await BaseResource._fetch( | ||
| { | ||
| method: 'GET', | ||
| path: `/me/organization_memberships`, | ||
| rotatingTokenNonce, | ||
| }, | ||
| { forceUpdateClient: true }, | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we need to include this parameter as well? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. brought it back | ||
| ); | ||
| const currentOrganization = (json?.response as unknown as OrganizationMembershipJSON[]).find( | ||
| orgMem => orgMem.organization.id === this.id, | ||
| ); | ||
| return this.fromJSON(currentOrganization?.organization as OrganizationJSON); | ||
| const json = ( | ||
| await BaseResource._fetch<OrganizationJSON>( | ||
| { | ||
| path: `/organizations/${this.id}`, | ||
| method: 'GET', | ||
| rotatingTokenNonce, | ||
| }, | ||
| { forceUpdateClient: true }, | ||
| ) | ||
| )?.response as unknown as OrganizationJSON; | ||
| return this.fromJSON(json); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃 Should we replace
consumedewithconsume?