Skip to content

Commit

Permalink
chore(console): update incorrect swr cache key usages (#5724)
Browse files Browse the repository at this point in the history
  • Loading branch information
charIeszhao authored Apr 16, 2024
1 parent 368385b commit 46b3c77
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Invitations() {
const { canInviteMember, canRemoveMember } = useCurrentTenantScopes();

const { data, error, isLoading, mutate } = useSWR<TenantInvitationResponse[], RequestError>(
'api/tenants/:tenantId/invitations',
`api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useEmailInputUtils = () => {
);

const { data: existingInvitations = [] } = useSWR<TenantInvitationResponse[], RequestError>(
'api/tenants/:tenantId/invitations',
`api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Members() {
const { canRemoveMember, canUpdateMemberRole } = useCurrentTenantScopes();

const { data, error, isLoading, mutate } = useSWR<TenantMemberResponse[], RequestError>(
`api/tenants/:tenantId/members`,
`api/tenants/${currentTenantId}/members`,
async () =>
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const useTenantMembersUsage = () => {
const cloudApi = useAuthedCloudApi();

const { data: members } = useSWR<TenantMemberResponse[], RequestError>(
`api/tenants/:tenantId/members`,
`api/tenants/${currentTenantId}/members`,
async () =>
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
);
const { data: invitations } = useSWR<TenantInvitationResponse[], RequestError>(
canInviteMember && 'api/tenants/:tenantId/invitations',
canInviteMember && `api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function TenantMembers() {
const { currentTenantId } = useContext(TenantsContext);
const cloudApi = useAuthedCloudApi();
const { trigger: mutateInvitations } = useSWRMutation(
'api/tenants/:tenantId/invitations',
`api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down

0 comments on commit 46b3c77

Please sign in to comment.