1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +00:00

udpate notificaiton module

This commit is contained in:
shanshuirenjia
2018-12-25 18:47:12 +08:00
parent 9e149ac2e1
commit f30617ae86

View File

@@ -13,30 +13,24 @@ class Notification extends React.Component {
}
componentDidMount() {
this.loadUnseenCount();
}
onClick = () => {
this.setState({
showNotice: !this.state.showNotice
});
if (!this.state.showNotice) {
this.loadNotices();
}
if (this.state.showNotice) {
seafileAPI.updateNotifications();
this.loadUnseenCount();
}
}
loadUnseenCount = () => {
seafileAPI.getUnseenCount().then(res => {
this.setState({unseenCount: res.data.unseen_count});
});
}
onClick = () => {
if (this.state.showNotice) {
seafileAPI.updateNotifications();
this.setState({
showNotice: false,
unseenCount: 0
})
} else {
this.loadNotices();
this.setState({showNotice: true});
}
}
loadNotices = () => {
seafileAPI.listPopupNotices().then(res => {
this.setState({