From 1a4eb1fabecf1356af51f3a0de5b4c432d42e828 Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Fri, 19 Nov 2021 12:47:47 +0530 Subject: [PATCH] chore: handle short code states --- .../components/http/Request.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/hoppscotch-app/components/http/Request.vue b/packages/hoppscotch-app/components/http/Request.vue index 4edc714d3..785f95811 100644 --- a/packages/hoppscotch-app/components/http/Request.vue +++ b/packages/hoppscotch-app/components/http/Request.vue @@ -168,7 +168,7 @@ /> { + shareLink.value = "" fetchingShareLink.value = true - setTimeout(() => (fetchingShareLink.value = false), 1000) - shareLink.value = new URL(window.location.href).pathname - + // 1. init loading + shareLinkStatus.value = t("state.loading") + // 2. TODO: fetch short code + shareLink.value = "/abcdefghij" + // 3. share / copy link to clipboard if (navigator.share) { const time = new Date().toLocaleTimeString() const date = new Date().toLocaleDateString() @@ -343,18 +347,21 @@ const copyRequest = () => { .share({ title: "Hoppscotch", text: `Hoppscotch • Open source API development ecosystem at ${time} on ${date}`, - url: window.location.href, + url: shareLink.value, }) .then(() => {}) .catch(() => {}) } else { copyLinkIcon.value = "check" - copyToClipboard(window.location.href) + copyToClipboard(shareLink.value) $toast.success(`${t("state.copied_to_clipboard")}`, { icon: "content_paste", }) setTimeout(() => (copyLinkIcon.value = "copy"), 2000) } + // 4. hide loading + fetchingShareLink.value = false + shareLinkStatus.value = shareLink.value } const cycleUpMethod = () => {