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

bugfixing v5

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