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 { useMemoizedFn } from '@/hooks';
|
||||||
import { QueryClient, useQueryClient } from '@tanstack/react-query';
|
import { QueryClient, useQueryClient } from '@tanstack/react-query';
|
||||||
import { queryKeys } from '@/api/query_keys';
|
import { queryKeys } from '@/api/query_keys';
|
||||||
import type { UserRequestUserListPayload } from '@/api/request_interfaces/user/interfaces';
|
|
||||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||||
import { useCreateOrganization } from '../organizations/queryRequests';
|
import { useCreateOrganization } from '../organizations';
|
||||||
|
|
||||||
export const useGetMyUserInfo = () => {
|
export const useGetMyUserInfo = () => {
|
||||||
return useQuery({
|
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));
|
const queryFn = useMemoizedFn(() => getUserList(params));
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
|
@ -154,7 +153,7 @@ export const useGetUserList = (params: UserRequestUserListPayload) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const prefetchGetUserList = async (
|
export const prefetchGetUserList = async (
|
||||||
params: UserRequestUserListPayload,
|
params: Parameters<typeof getUserList>[0],
|
||||||
queryClientProp?: QueryClient
|
queryClientProp?: QueryClient
|
||||||
) => {
|
) => {
|
||||||
const queryClient = queryClientProp || new QueryClient();
|
const queryClient = queryClientProp || new QueryClient();
|
||||||
|
|
|
@ -5,10 +5,7 @@ import type {
|
||||||
BusterUserFavorite,
|
BusterUserFavorite,
|
||||||
BusterUserListItem
|
BusterUserListItem
|
||||||
} from '@/api/asset_interfaces/users';
|
} from '@/api/asset_interfaces/users';
|
||||||
import type {
|
import type { UsersFavoritePostPayload } from '@/api/request_interfaces/user/interfaces';
|
||||||
UserRequestUserListPayload,
|
|
||||||
UsersFavoritePostPayload
|
|
||||||
} from '@/api/request_interfaces/user/interfaces';
|
|
||||||
import { mainApi } from '../instances';
|
import { mainApi } from '../instances';
|
||||||
import { serverFetch } from '../../createServerInstance';
|
import { serverFetch } from '../../createServerInstance';
|
||||||
|
|
||||||
|
@ -136,12 +133,16 @@ export const updateUserFavorites_server = async (payload: string[]) => {
|
||||||
|
|
||||||
//USER LIST
|
//USER LIST
|
||||||
|
|
||||||
export const getUserList = async (payload: UserRequestUserListPayload) => {
|
export const getUserList = async (payload: {
|
||||||
|
team_id: string;
|
||||||
|
page?: number;
|
||||||
|
page_size?: number;
|
||||||
|
}) => {
|
||||||
return mainApi
|
return mainApi
|
||||||
.get<BusterUserListItem[]>(`/users`, { params: payload })
|
.get<BusterUserListItem[]>(`/users`, { params: payload })
|
||||||
.then((response) => response.data);
|
.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 });
|
return serverFetch<BusterUserListItem[]>(`/users`, { params: payload });
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ import type {
|
||||||
OrganizationUser,
|
OrganizationUser,
|
||||||
BusterUserListItem
|
BusterUserListItem
|
||||||
} from '@/api/asset_interfaces/users';
|
} 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[]>({
|
const favoritesGetList = queryOptions<BusterUserFavorite[]>({
|
||||||
queryKey: ['users', 'favorites', 'list'] as const,
|
queryKey: ['users', 'favorites', 'list'] as const,
|
||||||
|
@ -54,7 +54,7 @@ const userGetUserDatasetGroups = (userId: string) =>
|
||||||
queryKey: ['users', userId, 'datasetGroups'] as const
|
queryKey: ['users', userId, 'datasetGroups'] as const
|
||||||
});
|
});
|
||||||
|
|
||||||
const userGetUserList = (params: UserRequestUserListPayload) =>
|
const userGetUserList = (params: Parameters<typeof getUserList>[0]) =>
|
||||||
queryOptions<BusterUserListItem[]>({
|
queryOptions<BusterUserListItem[]>({
|
||||||
queryKey: ['users', 'list', params] as const
|
queryKey: ['users', 'list', params] as const
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,9 +6,3 @@ export type UsersFavoritePostPayload = {
|
||||||
index?: number;
|
index?: number;
|
||||||
name: string; //just used for the UI for optimistic update
|
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