Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Allow duplication of global environment (#1924)
0xc0Der66d408b7dba7
diff --git a/packages/hoppscotch-app/components/environments/Environment.vue b/packages/hoppscotch-app/components/environments/Environment.vueindex ecdda9cd6..311431e1d 100644--- a/packages/hoppscotch-app/components/environments/Environment.vue+++ b/packages/hoppscotch-app/components/environments/Environment.vue@@ -42,7 +42,6 @@"/><SmartItem- v-if="!(environmentIndex === 'Global')"svg="copy":label="`${$t('action.duplicate')}`"@click.native="@@ -80,6 +79,10 @@ import { defineComponent, PropType } from "@nuxtjs/composition-api"import {deleteEnvironment,duplicateEnvironment,+ createEnvironment,+ setEnvironmentVariables,+ getGlobalVariables,+ environmentsStore,} from "~/newstore/environments"export default defineComponent({@@ -104,8 +107,16 @@ export default defineComponent({})},duplicateEnvironment() {- if (this.environmentIndex !== "Global")- duplicateEnvironment(this.environmentIndex)+ if (this.environmentIndex === "Global") {+ createEnvironment("Global-Copy")+ setEnvironmentVariables(+ environmentsStore.value.environments.length - 1,+ getGlobalVariables().reduce((gVars, gVar) => {+ gVars.push({ key: gVar.key, value: gVar.value })+ return gVars+ }, [])+ )+ } else duplicateEnvironment(this.environmentIndex)},},})