From fe30758a93d77c42de470faae1a868ddac26a165 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Thu, 9 Feb 2023 12:46:14 +0100 Subject: [PATCH] fixed retrieval of id and generation of filename --- ccp/js/methodeditorcontroller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ccp/js/methodeditorcontroller.js b/ccp/js/methodeditorcontroller.js index 9a7aab9..3f9a125 100644 --- a/ccp/js/methodeditorcontroller.js +++ b/ccp/js/methodeditorcontroller.js @@ -295,17 +295,17 @@ class CCPMethodEditorController extends HTMLElement{ }) } - downloadMethod(method){ + downloadMethod(){ if(this.#locked) return; this.lockRender() - var filename = this.#current.title + "-" + this.#current.version + ".json" - this.#boot.secureFetch(this.#serviceurl + "/methods/" + method + "/shareable").then( + this.#boot.secureFetch(this.#serviceurl + "/methods/" + this.#current.id + "/shareable").then( (resp)=>{ if(resp.status === 200){ return resp.json() }else throw "Error retrieving sharable process: " + resp.status } ).then(data=>{ + const filename = data.title + "-" + data.version + ".json" const objectURL = URL.createObjectURL(data) var tmplnk = document.createElement("a") tmplnk.download = filename @@ -803,7 +803,7 @@ class CCPMethodEditorController extends HTMLElement{ renderDownloadButton(){ return ` - `