Commit 681e5ded authored by muhammad ridwan's avatar muhammad ridwan

bugfixing v5

parent e8467239
......@@ -208,7 +208,7 @@ export default class CarfmDocument extends Component {
this.getDataCarfm('create')
}
else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
this.setState({ visibleCreate: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......
......@@ -19,7 +19,6 @@ export default class CreateCarfmDoc extends Component {
super(props)
this.state = {
perusahaan: null,
perusahaanData: null,
getPerusahaan: null,
errorPerusahaan: false,
msgErrorPerusahaan: '',
......@@ -47,7 +46,8 @@ export default class CreateCarfmDoc extends Component {
docId: '',
sizeUpload: "1",
menuName: null,
saveDisable: false
saveDisable: false,
submitVal: 0
}
}
......@@ -109,10 +109,10 @@ export default class CreateCarfmDoc extends Component {
// company_name: 'Default'
// })
let typeProps = {
options: typeData.sort((a, b) => a.company_name - b.company_name),
options: typeData.sort((a, b) => a.company_name.localeCompare(b.company_name)),
getOptionLabel: (option) => option.company_name,
};
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data })
this.setState({ perusahaan: typeProps}, () => console.log(this.state.perusahaan))
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -259,7 +259,7 @@ export default class CreateCarfmDoc extends Component {
}
else if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning', saveDisable: false })
} else {
} else if(this.state.submitVal === 1) {
const formData = new FormData();
formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id);
......@@ -460,8 +460,9 @@ export default class CreateCarfmDoc extends Component {
onClick={() =>
{
this.setState({
saveDisable: true
});
saveDisable: true,
submitVal : this.state.submitVal + 1
}, console.log());
this.props.handleLoading(1);
setTimeout(() => {
......
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