mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 23:47:06 +00:00
34 lines
974 B
TypeScript
34 lines
974 B
TypeScript
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|
|
|
import { apiRequest } from "@app/config/request";
|
|
import { TExternalGroupOrgRoleMappingList } from "@app/hooks/api/externalGroupOrgRoleMappings/types";
|
|
|
|
export const externalGroupOrgRoleMappingKeys = {
|
|
all: ["external-group-org-role-mapping"] as const,
|
|
list: () => [...externalGroupOrgRoleMappingKeys.all, "list"] as const
|
|
};
|
|
|
|
export const useGetExternalGroupOrgRoleMappings = (
|
|
options?: Omit<
|
|
UseQueryOptions<
|
|
TExternalGroupOrgRoleMappingList,
|
|
unknown,
|
|
TExternalGroupOrgRoleMappingList,
|
|
ReturnType<typeof externalGroupOrgRoleMappingKeys.list>
|
|
>,
|
|
"queryKey" | "queryFn"
|
|
>
|
|
) => {
|
|
return useQuery({
|
|
queryKey: externalGroupOrgRoleMappingKeys.list(),
|
|
queryFn: async () => {
|
|
const { data } = await apiRequest.get<TExternalGroupOrgRoleMappingList>(
|
|
"/api/v1/external-group-mappings"
|
|
);
|
|
|
|
return data;
|
|
},
|
|
...options
|
|
});
|
|
};
|