1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 00:09:40 +02:00

feat(waiting-room): choose relations when associated endpoint [EE-5187] (#8720)

This commit is contained in:
Chaim Lev-Ari 2023-05-14 09:26:11 +07:00 committed by GitHub
parent 511adabce2
commit 365316971b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 1712 additions and 303 deletions

View file

@ -5,15 +5,16 @@ import { EnvironmentType } from '@/react/portainer/environments/types';
import { EdgeGroup } from '../types';
import { queryKeys } from './query-keys';
import { buildUrl } from './build-url';
interface EdgeGroupListItemResponse extends EdgeGroup {
EndpointTypes: Array<EnvironmentType>;
}
async function getEdgeGroups() {
try {
const { data } = await axios.get<EdgeGroupListItemResponse[]>(
'/edge_groups'
);
const { data } = await axios.get<EdgeGroupListItemResponse[]>(buildUrl());
return data;
} catch (err) {
throw parseAxiosError(err as Error, 'Failed fetching edge groups');
@ -25,5 +26,5 @@ export function useEdgeGroups<T = EdgeGroupListItemResponse[]>({
}: {
select?: (groups: EdgeGroupListItemResponse[]) => T;
} = {}) {
return useQuery(['edge', 'groups'], getEdgeGroups, { select });
return useQuery(queryKeys.base(), getEdgeGroups, { select });
}