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: loading indicator to fetch short code

liyasthomasf602a1e2d3a1
diff --git a/packages/hoppscotch-app/components/http/Request.vue b/packages/hoppscotch-app/components/http/Request.vue
index 7d91014dd..4edc714d3 100644
--- a/packages/hoppscotch-app/components/http/Request.vue
+++ b/packages/hoppscotch-app/components/http/Request.vue
@@ -170,6 +170,7 @@
ref="copyRequest"
:label="shareLink ? shareLink : `${$t('request.copy_link')}`"
:svg="copyLinkIcon"
+ :loading="fetchingShareLink"
@click.native="
() => {
copyRequest()
@@ -328,8 +329,11 @@ const clearContent = () => {
const copyLinkIcon = hasNavigatorShare ? ref("share-2") : ref("copy")
const shareLink = ref("")
+const fetchingShareLink = ref(false)
const copyRequest = () => {
+ fetchingShareLink.value = true
+ setTimeout(() => (fetchingShareLink.value = false), 1000)
shareLink.value = new URL(window.location.href).pathname
if (navigator.share) {
@@ -349,7 +353,7 @@ const copyRequest = () => {
$toast.success(`${t("state.copied_to_clipboard")}`, {
icon: "content_paste",
})
- setTimeout(() => (copyLinkIcon.value = "copy"), 1000)
+ setTimeout(() => (copyLinkIcon.value = "copy"), 2000)
}
}