feat: completed org admin based project access feature

This commit is contained in:
=
2024-08-02 19:54:42 +05:30
parent 7f9150e60e
commit 13e0dd8e0f
29 changed files with 649 additions and 15 deletions
@@ -0,0 +1,30 @@
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/org-admin/projects",
{
params: {
limit,
offset,
search
}
}
);
return data;
}
});
};