mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 00:20:07 +00:00
udpate notificaiton module
This commit is contained in:
@@ -13,30 +13,24 @@ class Notification extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
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 => {
|
seafileAPI.getUnseenCount().then(res => {
|
||||||
this.setState({unseenCount: res.data.unseen_count});
|
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 = () => {
|
loadNotices = () => {
|
||||||
seafileAPI.listPopupNotices().then(res => {
|
seafileAPI.listPopupNotices().then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
Reference in New Issue
Block a user