You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
772 B

import { useQuery } from "react-query";
import { TUsersGetParams, userController } from "../../API/LayoutApi/users";
export const useUserData = ({name, team, role}: TUsersGetParams) => {
return useQuery(
[`users/admins/`, {name, team, role}],
() => userController.read({name, team, role}),
{ refetchOnWindowFocus: false }
);
};
export const useUserOne = (
userId: number | string | undefined
): any => {
return useQuery(
[`user/${userId || "all"}`, userId],
() => userController.userOne(userId),
{ refetchOnWindowFocus: false }
);
};
export const useCheckUser = (
username: string
): any => {
return useQuery(
[`user/${username}/`],
() => userController.CheckUsername(username),
{ refetchOnWindowFocus: false }
);
};