Skip to content

Commit

Permalink
chore(clerk-js): Use convertPageToOffset util in Organization class
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Aug 10, 2023
1 parent caff131 commit 0a5725f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions packages/clerk-js/src/core/resources/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import type {
UpdateMembershipParams,
UpdateOrganizationParams,
} from '@clerk/types';
import type { ClerkPaginationParams, GetUserOrganizationInvitationsParams } from '@clerk/types';

import { unixEpochToDate } from '../../utils/date';
import { convertPageToOffset } from '../../utils/pagesToOffset';
import { BaseResource, OrganizationInvitation, OrganizationMembership } from './internal';
import { OrganizationDomain } from './OrganizationDomain';

Expand Down Expand Up @@ -84,18 +84,6 @@ export class Organization extends BaseResource implements OrganizationResource {
getDomains = async (
getDomainParams?: GetDomainsParams,
): Promise<ClerkPaginatedResponse<OrganizationDomainResource>> => {
function convertPageToOffset(pageParams: GetUserOrganizationInvitationsParams | undefined): ClerkPaginationParams {
const { pageSize, initialPage, ...restParams } = pageParams || {};
const _pageSize = pageSize ?? 10;
const _initialPage = initialPage ?? 1;

return {
...restParams,
limit: _pageSize,
offset: (_initialPage - 1) * _pageSize,
};
}

return await BaseResource._fetch({
path: `/organizations/${this.id}/domains`,
method: 'GET',
Expand Down

0 comments on commit 0a5725f

Please sign in to comment.