user management ui

This commit is contained in:
yaschalew
2026-07-10 10:41:48 +03:00
parent dcb2d98503
commit 28a20923ff
595 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { OrganizationUserDto, User } from "@/shared/dto/user/usersDto";
import { getEmployeesUnderOrg } from "@/shared/services/organizationsService";
import { useQuery } from "@tanstack/react-query";
import { getUserById } from "../services/api/userService";
export const useUsers = (organizationId: string) => {
return useQuery({
queryKey: ["users"],
queryFn: async () => {
const { data } = await getEmployeesUnderOrg(organizationId);
return data as { items: OrganizationUserDto[]; count: number };
},
});
};
export const useUsersByID = (id: string) => {
return useQuery({
queryKey: ["user",id],
queryFn: async () => {
const response = await getUserById(id);
return response.data as User;
},
});
};