1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 06:19:41 +02:00
portainer/app/react/docker/proxy/queries/useExecResizeTTYMutation.ts

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

31 lines
711 B
TypeScript
Raw Normal View History

import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { buildDockerProxyUrl } from './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, 'exec', id, 'resize'),
{},
{
params: {
h: height,
w: width,
},
}
);
} catch (err) {
throw parseAxiosError(err, 'Unable to resize tty of exec');
}
}