import React from 'react'; const gettext = window.gettext; class Notification extends React.Component { constructor(props) { super(props); this.state = { showNotice: false, notice_html: '' } } onClick = () => { this.setState({ showNotice: !this.state.showNotice }) if (!this.state.showNotice) { this.loadNotices() } } loadNotices = () => { this.props.seafileAPI.getPopupNotices().then(res => { this.setState({ notice_html: res.data.notice_html }) }) } render() { return (
) } } export default Notification;