feat: add new variables to globals or create new environment

This commit is contained in:
liyasthomas
2022-02-22 12:29:17 +05:30
parent c357f17882
commit be1bb520a0
3 changed files with 74 additions and 4 deletions

View File

@@ -38,12 +38,18 @@
<script lang="ts">
import { defineComponent } from "@nuxtjs/composition-api"
import { createEnvironment } from "~/newstore/environments"
import { useReadonlyStream } from "~/helpers/utils/composables"
import { createEnvironment, environments$ } from "~/newstore/environments"
export default defineComponent({
props: {
show: Boolean,
},
setup() {
return {
envList: useReadonlyStream(environments$, []),
}
},
data() {
return {
name: null as string | null,
@@ -56,6 +62,11 @@ export default defineComponent({
return
}
createEnvironment(this.name)
// TODO: find better way to get index of new environment
this.$emit("environment-added", {
name: this.name,
index: this.envList.length - 1,
})
this.hideModal()
},
hideModal() {