-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLearningResourceEdit-submit
More file actions
35 lines (33 loc) · 1.06 KB
/
LearningResourceEdit-submit
File metadata and controls
35 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
fileTypeHandleChange(value) {
this.setState({
fileType: value.label
})
console.log(value.label)
}
onGetImageUploader(url) {
this.setState({
fileUrl: url
})
console.log('imgUploader:', url)
}
onSubmit() {
const data = {
title: this.state.title
, description: this.state.description
, fileUrl: this.state.fileUrl
, fileType: this.state.fileType
}
if(this.state.editMode) {
const formId = this.props.match.params.id;
const promise = learningResourceService.update(formId, data)
promise
.then(() => this.props.history.push('/data-management/learning-resource/list'))
.catch(console.error)
return promise
} else {
const promise = learningResourceService.create(data)
.then(() => this.props.history.push('/data-management/learning-resource/list'))
.catch(console.error)
return promise
}
}