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 return
} }
if (props.action === "new") {
createEnvironment(name.value)
setCurrentEnvironment(envList.value.length - 1)
}
const environmentUpdated: Environment = { const environmentUpdated: Environment = {
name: name.value, name: name.value,
variables: vars.value, variables: vars.value,
} }
if (props.editingEnvironmentIndex === "Global") if (props.action === "new") {
setGlobalEnvVariables(environmentUpdated.variables) // Creating a new environment
else if (props.action === "new") { createEnvironment(name.value)
updateEnvironment(envList.value.length - 1, environmentUpdated) updateEnvironment(envList.value.length - 1, environmentUpdated)
setCurrentEnvironment(envList.value.length - 1)
toast.success(`${t("environment.created")}`) toast.success(`${t("environment.created")}`)
} else { } else if (props.editingEnvironmentIndex === "Global") {
updateEnvironment(props.editingEnvironmentIndex!, environmentUpdated) // 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")}`) toast.success(`${t("environment.updated")}`)
} }
hideModal() hideModal()
} }