Skip to content

Commit

Permalink
chore(shared): Use deprecate helper for useOrganization
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Sep 26, 2023
1 parent 1040fa0 commit 27448be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/clerk-js/src/core/resources/Organization.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { deprecated } from '@clerk/shared';
import type {
AddMemberParams,
ClerkPaginatedResponse,
Expand Down Expand Up @@ -195,6 +196,7 @@ export class Organization extends BaseResource implements OrganizationResource {
getPendingInvitations = async (
getPendingInvitationsParams?: GetPendingInvitationsParams,
): Promise<OrganizationInvitation[]> => {
deprecated('getPendingInvitations', 'Use the `getInvitations` method instead.');
return await BaseResource._fetch({
path: `/organizations/${this.id}/invitations/pending`,
method: 'GET',
Expand Down
9 changes: 9 additions & 0 deletions packages/shared/src/hooks/useOrganization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useSWR } from './clerk-swr';
import { useClerkInstanceContext, useOrganizationContext, useSessionContext } from './contexts';
import type { PaginatedResources, PaginatedResourcesWithDefault } from './types';
import { usePagesOrInfinite, useWithSafeValues } from './usePagesOrInfinite';
import { deprecated } from '../utils';

type UseOrganizationParams = {
/**
Expand Down Expand Up @@ -290,6 +291,10 @@ export const useOrganization: UseOrganization = params => {
? () => [] as OrganizationMembershipResource[]
: () => clerk.organization?.getMemberships(membershipListParams);

if (invitationListParams) {
deprecated('invitationList in useOrganization', 'Use the `invitations` property and return value instead.');
}

const {
data: invitationList,
isValidating: isInvitationsLoading,
Expand All @@ -301,6 +306,10 @@ export const useOrganization: UseOrganization = params => {
pendingInvitations,
);

if (membershipListParams) {
deprecated('membershipList in useOrganization', 'Use the `memberships` property and return value instead.');
}

const {
data: membershipList,
isValidating: isMembershipsLoading,
Expand Down

0 comments on commit 27448be

Please sign in to comment.