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:
@@ -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({
|
||||
|
Reference in New Issue
Block a user