mirror of https://github.com/portainer/portainer
28 lines
711 B
TypeScript
28 lines
711 B
TypeScript
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');
|
|
}
|
|
}
|