From dd4fbd075a6d8be3e09a6a6a4f4861fa21ef1ef9 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 10 Jan 2023 16:57:49 +0000 Subject: [PATCH] Refactor --- .../integration/RestQueryViewer.svelte | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/builder/src/components/integration/RestQueryViewer.svelte b/packages/builder/src/components/integration/RestQueryViewer.svelte index 0aca58ae5e..cead197b30 100644 --- a/packages/builder/src/components/integration/RestQueryViewer.svelte +++ b/packages/builder/src/components/integration/RestQueryViewer.svelte @@ -117,15 +117,19 @@ ) } + function cleanUrl(inputUrl) { + return ( + url + ?.replace(/(http)|(https)|[{}:]/g, "") + ?.replaceAll(".", "_") + ?.replaceAll("/", " ") + ?.trim() || inputUrl + ) + } function checkQueryName(inputUrl = null) { if (query && (!query.name || query.flags.urlName)) { query.flags.urlName = true - query.name = - url - ?.replace(/(http)|(https)|[{}:]/g, "") - ?.replaceAll(".", "_") - ?.replaceAll("/", " ") - ?.trim() || inputUrl + query.name = cleanUrl(inputUrl) } }