mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix(ui): sending group users without orgid
This commit is contained in:
@@ -3,8 +3,8 @@ import { useQuery } from "@tanstack/react-query";
|
|||||||
import { apiRequest } from "@app/config/request";
|
import { apiRequest } from "@app/config/request";
|
||||||
|
|
||||||
export const groupKeys = {
|
export const groupKeys = {
|
||||||
getGroupUserMembership: (slug: string) => [{ slug }, "group-user-memberships"] as const
|
getGroupUserMembership: (slug: string) => [{ slug }, "group-user-memberships"] as const
|
||||||
}
|
};
|
||||||
|
|
||||||
type TUser = {
|
type TUser = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -13,17 +13,16 @@ type TUser = {
|
|||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
isPartOfGroup: boolean;
|
isPartOfGroup: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const useListGroupUsers = (groupSlug: string) => {
|
export const useListGroupUsers = (groupSlug: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: groupKeys.getGroupUserMembership(groupSlug),
|
queryKey: groupKeys.getGroupUserMembership(groupSlug),
|
||||||
|
enabled: Boolean(groupSlug),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const {
|
const { data: users } = await apiRequest.get<TUser[]>(`/api/v1/groups/${groupSlug}/users`);
|
||||||
data: users
|
|
||||||
} = await apiRequest.get<TUser[]>(`/api/v1/groups/${groupSlug}/users`);
|
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export const organizationKeys = {
|
|||||||
getOrgTaxIds: (orgId: string) => [{ orgId }, "organization-tax-ids"] as const,
|
getOrgTaxIds: (orgId: string) => [{ orgId }, "organization-tax-ids"] as const,
|
||||||
getOrgInvoices: (orgId: string) => [{ orgId }, "organization-invoices"] as const,
|
getOrgInvoices: (orgId: string) => [{ orgId }, "organization-invoices"] as const,
|
||||||
getOrgLicenses: (orgId: string) => [{ orgId }, "organization-licenses"] as const,
|
getOrgLicenses: (orgId: string) => [{ orgId }, "organization-licenses"] as const,
|
||||||
getOrgIdentityMemberships: (orgId: string) => [{ orgId }, "organization-identity-memberships"] as const,
|
getOrgIdentityMemberships: (orgId: string) =>
|
||||||
|
[{ orgId }, "organization-identity-memberships"] as const,
|
||||||
getOrgGroups: (orgId: string) => [{ orgId }, "organization-groups"] as const
|
getOrgGroups: (orgId: string) => [{ orgId }, "organization-groups"] as const
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -409,12 +410,15 @@ export const useDeleteOrgById = () => {
|
|||||||
export const useGetOrganizationGroups = (organizationId: string) => {
|
export const useGetOrganizationGroups = (organizationId: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: organizationKeys.getOrgGroups(organizationId),
|
queryKey: organizationKeys.getOrgGroups(organizationId),
|
||||||
|
enabled: Boolean(organizationId),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const {
|
const {
|
||||||
data: { groups }
|
data: { groups }
|
||||||
} = await apiRequest.get<{ groups: TGroupOrgMembership[] }>(`/api/v1/organization/${organizationId}/groups`);
|
} = await apiRequest.get<{ groups: TGroupOrgMembership[] }>(
|
||||||
|
`/api/v1/organization/${organizationId}/groups`
|
||||||
|
);
|
||||||
|
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user