1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

fix(edge/templates): fix issues [EE-6328] (#10656)

This commit is contained in:
Chaim Lev-Ari 2023-11-27 09:56:15 +02:00 committed by GitHub
parent 140ac5d17c
commit 76bcdfa2b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 181 additions and 91 deletions

View file

@ -15,17 +15,20 @@ export function useParseRegistries() {
});
}
export async function parseRegistries(props: {
export async function parseRegistries({
file,
fileContent,
}: {
file?: File;
fileContent?: string;
}) {
if (!props.file && !props.fileContent) {
if (!file && !fileContent) {
throw new Error('File or fileContent must be provided');
}
let currentFile = props.file;
if (!props.file && props.fileContent) {
currentFile = new File([props.fileContent], 'registries.yml');
let currentFile = file;
if (!file && fileContent) {
currentFile = new File([fileContent], 'registries.yml');
}
try {
const { data } = await axios.post<Array<RegistryId>>(