From 7d590ab96634cb9a9df8d711ac59a1abd24a945f Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Wed, 17 Nov 2021 02:36:40 +0530 Subject: [PATCH] feat: init short code ui --- packages/hoppscotch-app/components/http/Request.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/hoppscotch-app/components/http/Request.vue b/packages/hoppscotch-app/components/http/Request.vue index f13e2e854..7d91014dd 100644 --- a/packages/hoppscotch-app/components/http/Request.vue +++ b/packages/hoppscotch-app/components/http/Request.vue @@ -168,12 +168,11 @@ /> @@ -327,7 +326,12 @@ const clearContent = () => { resetRESTRequest() } +const copyLinkIcon = hasNavigatorShare ? ref("share-2") : ref("copy") +const shareLink = ref("") + const copyRequest = () => { + shareLink.value = new URL(window.location.href).pathname + if (navigator.share) { const time = new Date().toLocaleTimeString() const date = new Date().toLocaleDateString() @@ -340,10 +344,12 @@ const copyRequest = () => { .then(() => {}) .catch(() => {}) } else { + copyLinkIcon.value = "check" copyToClipboard(window.location.href) $toast.success(`${t("state.copied_to_clipboard")}`, { icon: "content_paste", }) + setTimeout(() => (copyLinkIcon.value = "copy"), 1000) } }