Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

feat: init short code ui

liyasthomas7d590ab96634
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 @@
/>
<SmartItem
ref="copyRequest"
- :label="`${$t('request.copy_link')}`"
- :svg="hasNavigatorShare ? 'share-2' : 'copy'"
+ :label="shareLink ? shareLink : `${$t('request.copy_link')}`"
+ :svg="copyLinkIcon"
@click.native="
() => {
copyRequest()
- saveOptions.tippy().hide()
}
"
/>
@@ -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)
}
}