Commit a6ad5deb authored by syadziy's avatar syadziy

update fixing UAT

parent ed408605
...@@ -184,17 +184,19 @@ export default class CarfmDocument extends Component { ...@@ -184,17 +184,19 @@ export default class CarfmDocument extends Component {
} }
createDocument(payload) { //upload apinya disini createDocument(payload) { //upload apinya disini
this.setState({ loading: true }) this.setState({ loading: true, visibleTrue: false })
api.create().uploadCarfmDocument(payload).then(response => { api.create().uploadCarfmDocument(payload).then(response => {
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.message === "Data was Saved Successfully") { if (response.data.message === "Data was Saved Successfully") {
this.setState({ visibleCreate: false, loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success'}) this.setState({ visibleCreate: false, visibleTrue: true, loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success'}, () => {
// window.location.reload();
})
// this.getDataCarfm('create') // this.getDataCarfm('create')
} }
else { else {
this.setState({ visibleCreate: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ visibleCreate: false, visibleTrue: true, 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)
...@@ -204,10 +206,10 @@ export default class CarfmDocument extends Component { ...@@ -204,10 +206,10 @@ export default class CarfmDocument extends Component {
}) })
} }
} else { } else {
this.setState({ visibleCreate: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ visibleCreate: false, visibleTrue: true, alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
} }
} else { } else {
this.setState({ visibleCreate: false, alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ visibleCreate: false, visibleTrue: true, alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
}) })
} }
......
...@@ -35,8 +35,8 @@ export default class TableDocument extends Component { ...@@ -35,8 +35,8 @@ export default class TableDocument extends Component {
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
// console.log(props); console.log(props);
const { refresh} = this.props; const {refresh} = this.props;
if (props.refresh !== refresh) { if (props.refresh !== refresh) {
this.getData() this.getData()
} }
...@@ -139,7 +139,6 @@ export default class TableDocument extends Component { ...@@ -139,7 +139,6 @@ export default class TableDocument extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.props.btndownload && <a data-tip={'Download'} data-for="download"> {this.props.btndownload && <a data-tip={'Download'} data-for="download">
...@@ -155,9 +154,7 @@ export default class TableDocument extends Component { ...@@ -155,9 +154,7 @@ export default class TableDocument extends Component {
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a>} </a>}
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
......
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