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

@@ -120,6 +120,7 @@ import clone from "lodash/clone"
import { computed, ref, watch } from "@nuxtjs/composition-api"
import * as E from "fp-ts/Either"
import { Environment, parseTemplateStringE } from "@hoppscotch/data"
import { refAutoReset } from "@vueuse/core"
import {
createEnvironment,
environments$,
@@ -160,7 +161,8 @@ const emit = defineEmits<{
const name = ref<string | null>(null)
const vars = ref([{ key: "", value: "" }])
const clearIcon = ref("trash-2")
const clearIcon = refAutoReset<"trash-2" | "check">("trash-2", 1000)
const globalVars = useReadonlyStream(globalEnv$, [])
@@ -225,7 +227,6 @@ const clearContent = () => {
vars.value = []
clearIcon.value = "check"
toast.success(`${t("state.cleared")}`)
setTimeout(() => (clearIcon.value = "trash-2"), 1000)
}
const addEnvironmentVariable = () => {