mirror of https://github.com/buster-so/buster.git
update evals
This commit is contained in:
parent
11775ac6ab
commit
3e6359f066
|
@ -17,9 +17,8 @@ import {
|
|||
import { useMemoizedFn } from '@/hooks';
|
||||
import { QueryClient, useQueryClient } from '@tanstack/react-query';
|
||||
import { queryKeys } from '@/api/query_keys';
|
||||
import type { UserRequestUserListPayload } from '@/api/request_interfaces/user/interfaces';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { useCreateOrganization } from '../organizations/queryRequests';
|
||||
import { useCreateOrganization } from '../organizations';
|
||||
|
||||
export const useGetMyUserInfo = () => {
|
||||
return useQuery({
|
||||
|
@ -144,7 +143,7 @@ export const useUpdateUserFavorites = () => {
|
|||
});
|
||||
};
|
||||
|
||||
export const useGetUserList = (params: UserRequestUserListPayload) => {
|
||||
export const useGetUserList = (params: Parameters<typeof getUserList>[0]) => {
|
||||
const queryFn = useMemoizedFn(() => getUserList(params));
|
||||
|
||||
return useQuery({
|
||||
|
@ -154,7 +153,7 @@ export const useGetUserList = (params: UserRequestUserListPayload) => {
|
|||
};
|
||||
|
||||
export const prefetchGetUserList = async (
|
||||
params: UserRequestUserListPayload,
|
||||
params: Parameters<typeof getUserList>[0],
|
||||
queryClientProp?: QueryClient
|
||||
) => {
|
||||
const queryClient = queryClientProp || new QueryClient();
|
||||
|
|
|
@ -5,10 +5,7 @@ import type {
|
|||
BusterUserFavorite,
|
||||
BusterUserListItem
|
||||
} from '@/api/asset_interfaces/users';
|
||||
import type {
|
||||
UserRequestUserListPayload,
|
||||
UsersFavoritePostPayload
|
||||
} from '@/api/request_interfaces/user/interfaces';
|
||||
import type { UsersFavoritePostPayload } from '@/api/request_interfaces/user/interfaces';
|
||||
import { mainApi } from '../instances';
|
||||
import { serverFetch } from '../../createServerInstance';
|
||||
|
||||
|
@ -136,12 +133,16 @@ export const updateUserFavorites_server = async (payload: string[]) => {
|
|||
|
||||
//USER LIST
|
||||
|
||||
export const getUserList = async (payload: UserRequestUserListPayload) => {
|
||||
export const getUserList = async (payload: {
|
||||
team_id: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}) => {
|
||||
return mainApi
|
||||
.get<BusterUserListItem[]>(`/users`, { params: payload })
|
||||
.then((response) => response.data);
|
||||
};
|
||||
|
||||
export const getUserList_server = async (payload: UserRequestUserListPayload) => {
|
||||
export const getUserList_server = async (payload: Parameters<typeof getUserList>[0]) => {
|
||||
return serverFetch<BusterUserListItem[]>(`/users`, { params: payload });
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ import type {
|
|||
OrganizationUser,
|
||||
BusterUserListItem
|
||||
} from '@/api/asset_interfaces/users';
|
||||
import type { UserRequestUserListPayload } from '@/api/request_interfaces/user/interfaces';
|
||||
import { getUserList } from '../buster_rest/users/requests';
|
||||
|
||||
const favoritesGetList = queryOptions<BusterUserFavorite[]>({
|
||||
queryKey: ['users', 'favorites', 'list'] as const,
|
||||
|
@ -54,7 +54,7 @@ const userGetUserDatasetGroups = (userId: string) =>
|
|||
queryKey: ['users', userId, 'datasetGroups'] as const
|
||||
});
|
||||
|
||||
const userGetUserList = (params: UserRequestUserListPayload) =>
|
||||
const userGetUserList = (params: Parameters<typeof getUserList>[0]) =>
|
||||
queryOptions<BusterUserListItem[]>({
|
||||
queryKey: ['users', 'list', params] as const
|
||||
});
|
||||
|
|
|
@ -6,9 +6,3 @@ export type UsersFavoritePostPayload = {
|
|||
index?: number;
|
||||
name: string; //just used for the UI for optimistic update
|
||||
};
|
||||
|
||||
export interface UserRequestUserListPayload {
|
||||
team_id: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue