fix: regressions in environment details modal

This commit is contained in:
Andrew Bastin
2022-04-22 11:58:29 +05:30
parent bf97d8811c
commit 021908c8d1

View File

@@ -245,25 +245,27 @@ const saveEnvironment = () => {
return
}
if (props.action === "new") {
createEnvironment(name.value)
setCurrentEnvironment(envList.value.length - 1)
}
const environmentUpdated: Environment = {
name: name.value,
variables: vars.value,
}
if (props.editingEnvironmentIndex === "Global")
setGlobalEnvVariables(environmentUpdated.variables)
else if (props.action === "new") {
if (props.action === "new") {
// Creating a new environment
createEnvironment(name.value)
updateEnvironment(envList.value.length - 1, environmentUpdated)
setCurrentEnvironment(envList.value.length - 1)
toast.success(`${t("environment.created")}`)
} else {
updateEnvironment(props.editingEnvironmentIndex!, environmentUpdated)
} else if (props.editingEnvironmentIndex === "Global") {
// Editing the Global environment
setGlobalEnvVariables(environmentUpdated.variables)
toast.success(`${t("environment.updated")}`)
} else if (props.editingEnvironmentIndex) {
// Editing an environment
updateEnvironment(props.editingEnvironmentIndex, environmentUpdated)
toast.success(`${t("environment.updated")}`)
}
hideModal()
}