Files
2026-03-18 16:01:17 +13:00

27 lines
672 B
TypeScript

import axios, { parseAxiosError } from '@/portainer/services/axios/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { buildDockerProxyUrl } from '../buildDockerProxyUrl';
/**
* Raw docker API proxy
* @param environmentId
* @param file
* @returns
*/
export async function uploadImages(environmentId: EnvironmentId, file: File) {
try {
return await axios.post(
buildDockerProxyUrl(environmentId, 'images', 'load'),
file,
{
headers: {
'Content-Type': file.type, // 'application/x-tar',
},
}
);
} catch (e) {
throw parseAxiosError(e, 'Unable to upload image');
}
}