refactor: use refAutoReset instead of settimeout (#2385)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Liyas Thomas
2022-06-01 16:54:37 +05:30
committed by GitHub
parent 39f72f8458
commit cf90d16f8a
18 changed files with 62 additions and 53 deletions

View File

@@ -28,7 +28,7 @@
</template>
<script setup lang="ts">
import { ref } from "@nuxtjs/composition-api"
import { refAutoReset } from "@vueuse/core"
import { HoppRESTHeader } from "~/../hoppscotch-data/dist"
import { copyToClipboard } from "~/helpers/utils/clipboard"
import { useI18n, useToast } from "~/helpers/utils/composables"
@@ -41,12 +41,11 @@ defineProps<{
header: HoppRESTHeader
}>()
const copyIcon = ref("copy")
const copyIcon = refAutoReset<"copy" | "check">("copy", 1000)
const copyHeader = (headerValue: string) => {
copyToClipboard(headerValue)
copyIcon.value = "check"
toast.success(`${t("state.copied_to_clipboard")}`)
setTimeout(() => (copyIcon.value = "copy"), 1000)
}
</script>