You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/docker/tasks/queries/useTaskLogs.ts

26 lines
720 B

import _ from 'lodash';
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { TaskId, TaskLogsParams } from '@/react/docker/tasks/types';
import { buildDockerProxyUrl } from '../../proxy/queries/buildDockerProxyUrl';
export async function getTaskLogs(
environmentId: EnvironmentId,
taskId: TaskId,
params?: TaskLogsParams
): Promise<string> {
try {
const { data } = await axios.get<string>(
buildDockerProxyUrl(environmentId, 'tasks', taskId, 'logs'),
{
params: _.pickBy(params),
}
);
return data;
} catch (e) {
throw parseAxiosError(e, 'Unable to get task logs');
}
}