1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-27 01:09:41 +02:00
portainer/app/react/docker/tasks/queries/useTask.ts

20 lines
613 B
TypeScript
Raw Normal View History

import { Task } from 'docker-types/generated/1.41';
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { TaskId } from '@/react/docker/tasks/types';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { buildDockerProxyUrl } from '../../proxy/queries/buildDockerProxyUrl';
export async function getTask(environmentId: EnvironmentId, taskId: TaskId) {
try {
const { data } = await axios.get<Task>(
buildDockerProxyUrl(environmentId, 'tasks', taskId)
);
return data;
} catch (e) {
throw parseAxiosError(e, 'Unable to get task');
}
}