react-relogin
v1.0.5
Published
react re-login dialog component
Downloads
1
Readme
Install
npm i react-relogin
Usage
import React from 'react'
import Relogin from 'react-relogin'
class Demo extends React.Component {
constructor() {
super();
this.state = {
visible: false,
account: 'admin',
leftTime: 9999999
}
}
login = (data) => {
if (common.isEmpty(data.password)) {
message.warn("请输入密码");
return
}
const data = { "username": data.account, "password": data.password }
// todo login
}
render() {
const reloginProps = {
visible: this.state.visible,
account: this.state.account,
leftTime: this.state.leftTime,
onOk: (data) => { this.login(data) },
onCancel: () => {
this.setState({ visible: false }, () => this.props.history.push("/login") )
},
leftTimeCallback: () => {
this.setState({ visible: true })
}
}
return <Relogin {...reloginProps} />
}
}
export default Demo;