Commit af356595 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

maintenance login

See merge request !1667
parents 21ba5a14 e253eae9
......@@ -38,7 +38,10 @@ class Login extends Component {
tipeAlert: '',
messageAlert: '',
width: 0,
height: 0
height: 0,
maintenanceHeadline: "",
maintenanceContent: "",
maintenanceStatus: null,
}
}
......@@ -98,11 +101,16 @@ class Login extends Component {
if (response.ok) {
if (response.data.status === 'success') {
// console.log(response.data.data)
if (response.data.data.role_id === 185 && response.data.maintenance_mode === 'ACTIVE'){
this.props.history.push('/maintenance')
let datas = response.data.data
if (datas.maintenance_status === 1) {
this.setState({
maintenanceHeadline: datas.maintenance_headline,
maintenanceContent: datas.maintenance_content,
maintenanceStatus: datas.maintenance_status
})
} else {
localStorage.setItem(Constant.TOKEN, response.data.data.token)
localStorage.setItem(Constant.USER, response.data.data.user_id)
localStorage.setItem(Constant.TOKEN, datas.token)
localStorage.setItem(Constant.USER, datas.user_id)
if (this.state.rememberMe) {
localStorage.setItem(Constant.EMAIL, this.state.email)
localStorage.setItem(Constant.PASSWORD, this.state.password)
......@@ -113,6 +121,7 @@ class Login extends Component {
}
this.props.history.push('/home/beranda')
}
} else {
if (response.data.message == 'Password is Not Correct') {
this.setState({ errorPassword: true, msgPassword: 'Incorrect Password' })
......@@ -149,18 +158,24 @@ class Login extends Component {
</Alert>
</Snackbar>
<div style={{ width: '50%', display: 'grid' }}>
<img src={Images.meeting} style={{ objectFit: 'fill', width: '100%', height: '100%' }}/>
<img src={Images.meeting} style={{ objectFit: 'fill', width: '100%', height: '100%' }} />
{/* <img src={Images.imageLogin} style={{ marginTop: 30 }} /> */}
</div>
<div style={{ width: '50%', height: '100vh', backgroundColor: '#263b80', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
{this.state.maintenanceStatus === 1 ?
<div>
<Typography style={{ color: '#fff', fontSize: 20, margin: '10px 40px'}}>{this.state.maintenanceHeadline}</Typography>
<Typography style={{ color: '#fff', fontSize: 20, margin: 40}}>{this.state.maintenanceContent}</Typography>
</div>
:
<form onSubmit={(e) => {
e.preventDefault()
this.validateLogin()
}}
>
<div style={{ maxWidth: 397, paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 485 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} />
<img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center' }} />
<TextField
label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Email *</Typography>}
......@@ -230,6 +245,7 @@ class Login extends Component {
</button>
</div>
</form>
}
</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