1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 14:59:41 +02:00
portainer/app/react/docker/containers/queries/useContainerResizeTTYMutation.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
711 B
TypeScript
Raw Permalink Normal View History

import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { buildDockerProxyUrl } from '../../proxy/queries/buildDockerProxyUrl';
/**
* Raw docker API proxy
* @param environmentId
* @param id exec instance id
*/
export async function resizeTTY(
environmentId: EnvironmentId,
id: string,
{ width, height }: { width: number; height: number }
) {
try {
await axios.post(
buildDockerProxyUrl(environmentId, 'containers', id, 'resize'),
{},
{
params: { h: height, w: width },
}
);
} catch (err) {
throw parseAxiosError(err, 'Unable to resize tty of container');
}
}