1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 11:21:29 +00:00

[user settings] rewrote it with react

This commit is contained in:
llj
2019-05-07 14:57:22 +08:00
parent 18aa3f30e9
commit f4725faf0b
18 changed files with 991 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
import { gettext } from '../../utils/constants';
const propTypes = {
formActionURL: PropTypes.string.isRequired,
csrfToken: PropTypes.string.isRequired,
toggle: PropTypes.func.isRequired
};
class ConfirmDisconnectWechat extends Component {
constructor(props) {
super(props);
this.form = React.createRef();
}
disconnect = () => {
this.form.current.submit();
}
render() {
const {formActionURL, csrfToken, toggle} = this.props;
return (
<Modal centered={true} isOpen={true} toggle={toggle}>
<ModalHeader toggle={toggle}>{gettext('Disconnect')}</ModalHeader>
<ModalBody>
<p>{gettext('Are you sure you want to disconnect?')}</p>
<form ref={this.form} className="d-none" method="post" action={formActionURL}>
<input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} />
</form>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.disconnect}>{gettext('Disconnect')}</Button>
</ModalFooter>
</Modal>
);
}
}
ConfirmDisconnectWechat.propTypes = propTypes;
export default ConfirmDisconnectWechat;