Commit 56482014 authored by d.arizona's avatar d.arizona

update

parent 2311975c
......@@ -40,16 +40,23 @@ export default class UserRole extends Component {
messageAlert: '',
buttonCreate: false,
buttonEdit: false,
buttonDelete: false,
load: false,
judul: ''
}
}
componentDidMount() {
this.daskdkas()
this.getUser()
this.getPermission()
}
async daskdkas() {
let res = await localStorage.getItem(Constant.TOKEN)
console.log(res)
}
closeEdit() {
this.setState({ edit: false })
}
......@@ -99,6 +106,7 @@ export default class UserRole extends Component {
this.setState({
buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true
})
} else {
......@@ -401,6 +409,7 @@ export default class UserRole extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.getUser()
this.closeEdit()
window.location.reload();
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -430,6 +439,7 @@ export default class UserRole extends Component {
if (response.data.status === 'Success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', add: false })
this.getUser()
window.location.reload();
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -472,9 +482,9 @@ export default class UserRole extends Component {
if (response.ok) {
if (response.data.status === "success") {
this.getUser()
this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success', payload: [], rows: [], judul: '' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', payload: [], rows: [], judul: '' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -484,10 +494,10 @@ export default class UserRole extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', payload: [], rows: [], judul: '' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', payload: [], rows: [], judul: '' })
}
})
}
......@@ -518,7 +528,7 @@ export default class UserRole extends Component {
<img src={Images.editCopy} />
</button>
)}
{this.state.buttonEdit && (
{this.state.buttonDelete && (
<button
style={{
backgroundColor: 'transparent',
......@@ -801,11 +811,11 @@ export default class UserRole extends Component {
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<img src={Images.failedCopy} />
<img src={Images.failed} />
</div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
Delete {this.state.rowData[2]} ?
Delete {titleCase(this.state.rowData[2])} ?
</span>
{/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
......
......@@ -36,6 +36,7 @@ class UserRole extends Component {
messageAlert: '',
buttonCreate: false,
buttonEdit: false,
buttonDelete: false,
load: false
}
}
......@@ -98,6 +99,7 @@ class UserRole extends Component {
this.setState({
buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true
})
} else {
......@@ -215,7 +217,7 @@ class UserRole extends Component {
</div >
</button>
)}
{this.state.buttonEdit && (
{this.state.buttonDelete && (
<button
style={{
backgroundColor: 'transparent',
......@@ -363,11 +365,11 @@ class UserRole extends Component {
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<img src={Images.failedCopy} />
<img src={Images.failed} />
</div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
Delete {this.state.rowData[2]} ?
Delete {titleCase(this.state.rowData[2])} ?
</span>
{/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
......
......@@ -142,6 +142,7 @@ export default class AddRole extends Component {
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
window.location.reload();
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......
......@@ -168,6 +168,7 @@ export default class EditRole extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => {
this.props.onClickClose()
window.location.reload();
this.props.refresh()
}, 750);
} else {
......@@ -621,6 +622,9 @@ export default class EditRole extends Component {
<div className="column 3">
<Typography style={{ fontSize: 12, color: 'white' }}>Edit</Typography>
</div>
<div className="column 4">
<Typography style={{ fontSize: 12, color: 'white' }}>Delete</Typography>
</div>
</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