Update handleSubmit to only send workspace in properties if a new config

pull/3465/head
Iris Scholten 2018-05-09 12:17:05 -07:00
parent ce39c0a7b5
commit 2ed842c085
1 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
channel: string
url: string
workspace?: string
enabled: boolean
}
interface Config {
@ -143,11 +145,13 @@ class SlackConfig extends PureComponent<Props, State> {
private handleSubmit = async e => {
const {isNewConfig} = this.props
e.preventDefault()
const properties = {
const properties: Properties = {
url: this.url.value,
channel: this.channel.value,
enabled: this.state.enabled,
workspace: this.workspace.value,
}
if (isNewConfig) {
properties.workspace = this.workspace.value
}
const success = await this.props.onSave(properties, isNewConfig)
if (success) {