mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 01:05:40 +00:00
30 lines
736 B
TypeScript
30 lines
736 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { apiRequest } from "@app/config/request";
|
|
|
|
import { ScimTokenData } from "./types";
|
|
|
|
export const scimKeys = {
|
|
getScimTokens: (orgId: string) => [{ orgId }, "organization-scim-token"] as const
|
|
};
|
|
|
|
export const useGetScimTokens = (organizationId: string) => {
|
|
return useQuery({
|
|
queryKey: scimKeys.getScimTokens(organizationId),
|
|
queryFn: async () => {
|
|
if (organizationId === "") {
|
|
return undefined;
|
|
}
|
|
|
|
const {
|
|
data: { scimTokens }
|
|
} = await apiRequest.get<{ scimTokens: ScimTokenData[] }>(
|
|
`/api/v1/scim/scim-tokens?organizationId=${organizationId}`
|
|
);
|
|
|
|
return scimTokens;
|
|
},
|
|
enabled: true
|
|
});
|
|
};
|