Commit 3f526095 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

upload edit managdoc

parent ec7b4016
......@@ -63,11 +63,17 @@ export default class CreateManagementDoc extends Component {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.length == 0){
this.setState({
sizeUpload: 1
})
} else {
this.setState({
sizeUpload: response.data.data[0].value
})
}
}
}
})
}
......
......@@ -65,11 +65,17 @@ export default class EditManagementDoc extends Component {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.length == 0){
this.setState({
sizeUpload: 1
})
} else {
this.setState({
sizeUpload: response.data.data[0].value
})
}
}
}
})
}
......@@ -88,6 +94,7 @@ export default class EditManagementDoc extends Component {
period: data.document_periode,
getMonthName: data.document_month,
description: data.description,
filePath: data.document_filepath,
file: data.document_filepath,
document_name: data.document_name,
document_size: data.document_size,
......@@ -279,6 +286,10 @@ export default class EditManagementDoc extends Component {
// this.setState({ errorDocument: true, msgErrorDocument: 'File Cannot be Empty' })
} else {
const formData = new FormData();
if (this.state.file == this.state.filePath){
formData.append("updated", 0);
}
formData.append("updated", 1);
formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("settingId", this.state.getDocument.document_category_id);
......@@ -290,6 +301,7 @@ export default class EditManagementDoc extends Component {
this.setState({ formData }, () => {
this.props.updateDocument(this.state.formData)
})
console.log(JSON.stringify(formData))
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment