Files
2026-07-13 12:08:39 +08:00

25 lines
680 B
TypeScript

import axios, { parseAxiosError } from '@/portainer/services/axios/axios';
import { EnvironmentGroupId } from '../types';
import { buildUrl } from './queries/build-url';
import { EnvironmentGroup } from './types';
export async function getGroup(id: EnvironmentGroupId) {
try {
const { data: group } = await axios.get<EnvironmentGroup>(buildUrl(id));
return group;
} catch (e) {
throw parseAxiosError(e, 'Unable to retrieve group');
}
}
export async function getGroups() {
try {
const { data: groups } = await axios.get<EnvironmentGroup[]>(buildUrl());
return groups;
} catch (e) {
throw parseAxiosError(e, 'Unable to retrieve groups');
}
}