mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 18:15:53 +00:00
31 lines
831 B
TypeScript
31 lines
831 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { apiRequest } from "@app/config/request";
|
|
|
|
import { Workspace } from "../types";
|
|
import { TOrgAdminGetProjectsDTO } from "./types";
|
|
|
|
export const orgAdminQueryKeys = {
|
|
getProjects: (filter: TOrgAdminGetProjectsDTO) => ["org-admin-projects", filter] as const
|
|
};
|
|
|
|
export const useOrgAdminGetProjects = ({ search, offset, limit = 50 }: TOrgAdminGetProjectsDTO) => {
|
|
return useQuery({
|
|
queryKey: orgAdminQueryKeys.getProjects({ search, offset, limit }),
|
|
queryFn: async () => {
|
|
const { data } = await apiRequest.get<{ projects: Workspace[]; count: number }>(
|
|
"/api/v1/organization-admin/projects",
|
|
{
|
|
params: {
|
|
limit,
|
|
offset,
|
|
search
|
|
}
|
|
}
|
|
);
|
|
|
|
return data;
|
|
}
|
|
});
|
|
};
|