From 816645678c8cef2b96f912acc991768744b8f0c3 Mon Sep 17 00:00:00 2001 From: SergioLangaritaBenitez Date: Fri, 2 Feb 2024 11:50:24 +0100 Subject: [PATCH] Fix FDL EGI error --- src/components/forms/FDLForm.vue | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/forms/FDLForm.vue b/src/components/forms/FDLForm.vue index 578b0be..6a87a69 100644 --- a/src/components/forms/FDLForm.vue +++ b/src/components/forms/FDLForm.vue @@ -216,15 +216,22 @@ export default { } var params=this.prepareFunction() const response = await fetch(this.api+'/system/services',options); - const json = await response.json(); - let result = json.map(service => service.name); + if (response != null){ + const json = await response.json(); + let result = json.map(service => service.name); + }else{ + options.method="PUT" + var typecall="created" + } for (let index = 0; index < params.length; index++) { - if(result.includes(params[index].name)){ - options.method="PUT" - var typecall="created" - }else{ - options.method="POST" - var typecall="edited" + if (response != null){ + if( result.includes(params[index].name)){ + options.method="PUT" + var typecall="created" + }else{ + options.method="POST" + var typecall="edited" + } } options.body= JSON.stringify(params[index]) const response = await fetch(this.api+'/system/services',options);