Commit f2c40ce5 authored by Riri Novita's avatar Riri Novita

token expired

parent 0a799d7b
......@@ -75,7 +75,18 @@ export default class SubHolding extends Component {
this.setState({ userCompany: response.data.data.company }, () => {
this.getCompanyActive()
})
} 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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error'})
}
}
})
......
......@@ -95,7 +95,18 @@ export default class SummaryOfTriputra extends Component {
// this.getRevision()
// }
})
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -129,7 +140,18 @@ export default class SummaryOfTriputra extends Component {
this.getDataTable()
})
console.log(this.state.month)
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -211,6 +233,7 @@ export default class SummaryOfTriputra extends Component {
console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status === 'success') {
let res = [response.data.data]
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
......@@ -319,6 +342,16 @@ export default class SummaryOfTriputra extends Component {
})
console.log(dataTable)
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......@@ -329,6 +362,7 @@ export default class SummaryOfTriputra extends Component {
console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status === 'success') {
let res = [response.data.data]
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
......@@ -449,6 +483,16 @@ export default class SummaryOfTriputra extends Component {
})
console.log(dataTable)
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......@@ -459,6 +503,7 @@ export default class SummaryOfTriputra extends Component {
console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status === 'success') {
let res = [response.data.data]
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
......@@ -589,6 +634,16 @@ export default class SummaryOfTriputra extends Component {
})
console.log(dataTable);
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......@@ -599,6 +654,7 @@ export default class SummaryOfTriputra extends Component {
console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status === 'success') {
let res = [response.data.data]
console.log(res)
const handlePushChild = (item) => {
......@@ -776,6 +832,16 @@ export default class SummaryOfTriputra extends Component {
})
console.log()
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ 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)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......
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