Skip to content

Commit

Permalink
CSCFAIRMETA-840: Clear submit response between datasets (#645)
Browse files Browse the repository at this point in the history
  • Loading branch information
tahme authored Dec 10, 2020
1 parent 33c14a9 commit 24fd0f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ export class Qvain extends Component {
}

clearSubmitResponse = () => {
const { clearResponse, setError } = this.props.Stores.Qvain.Submit
clearResponse()
setError(null)
this.setState({
datasetLoading: false,
submitted: false,
response: null,
})
}
Expand Down
5 changes: 4 additions & 1 deletion etsin_finder/frontend/js/stores/view/qvain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Qvain extends Resources {
super()
this.Env = Env
this.Files = new Files(this)
this.resetQvainStore()
this.Submit = new Submit(this)
this.resetQvainStore()
makeObservable(this)
}

Expand Down Expand Up @@ -49,6 +49,8 @@ class Qvain extends Resources {

this.changed = false
this.deprecated = false

this.Submit.reset()
}

@action
Expand Down Expand Up @@ -259,6 +261,7 @@ class Qvain extends Resources {
}

@action editDataset = async dataset => {
this.Submit.reset()
this.setChanged(false)
this.original = { ...dataset }
this.loadBasicFields(dataset)
Expand Down
7 changes: 7 additions & 0 deletions etsin_finder/frontend/js/stores/view/qvain/qvain.submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class Submit {

@observable useDoiModalIsOpen = false

@action reset = () => {
this.isLoading = false
this.error = undefined
this.response = null
this.useDoiModalIsOpen = false
}

@action setLoading = state => {
this.isLoading = state
}
Expand Down

0 comments on commit 24fd0f9

Please sign in to comment.