Fix campaign UI to update start/schedule button automatically
This commit is contained in:
parent
ba87801930
commit
68c4ccdefc
|
@ -322,6 +322,7 @@ class TheFormDef extends React.PureComponent {
|
||||||
description: `"${values["name"]}" updated`
|
description: `"${values["name"]}" updated`
|
||||||
})
|
})
|
||||||
this.setState({ loading: false })
|
this.setState({ loading: false })
|
||||||
|
this.props.setRecord(resp.data.data)
|
||||||
cb(true)
|
cb(true)
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
@ -632,12 +633,17 @@ class Campaign extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setRecord = r => {
|
||||||
|
this.setState({ record: r })
|
||||||
|
}
|
||||||
|
|
||||||
fetchRecord = id => {
|
fetchRecord = id => {
|
||||||
this.props
|
this.props
|
||||||
.request(cs.Routes.GetCampaign, cs.MethodGet, { id: id })
|
.request(cs.Routes.GetCampaign, cs.MethodGet, { id: id })
|
||||||
.then(r => {
|
.then(r => {
|
||||||
const record = r.data.data
|
const record = r.data.data
|
||||||
this.setState({ record: record, loading: false })
|
this.setState({ loading: false })
|
||||||
|
this.setRecord(record)
|
||||||
|
|
||||||
// The form for non draft and scheduled campaigns should be locked.
|
// The form for non draft and scheduled campaigns should be locked.
|
||||||
if (
|
if (
|
||||||
|
@ -780,6 +786,7 @@ class Campaign extends React.PureComponent {
|
||||||
this.setState({ formRef: r })
|
this.setState({ formRef: r })
|
||||||
}}
|
}}
|
||||||
record={this.state.record}
|
record={this.state.record}
|
||||||
|
setRecord={this.setRecord}
|
||||||
isSingle={this.state.record.id ? true : false}
|
isSingle={this.state.record.id ? true : false}
|
||||||
body={
|
body={
|
||||||
this.state.body ? this.state.body : this.state.record.body
|
this.state.body ? this.state.body : this.state.record.body
|
||||||
|
|
Loading…
Reference in New Issue