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

update

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