mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-12 04:12:16 +00:00
optimize code
This commit is contained in:
parent
c904526506
commit
c4b57a867d
@ -13,7 +13,7 @@ class SystemUserNotificationItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close = () => {
|
close = () => {
|
||||||
this.setState({isClosed: true});
|
this.setState({ isClosed: true });
|
||||||
notificationAPI.setSysUserNotificationToSeen(this.props.notificationID);
|
notificationAPI.setSysUserNotificationToSeen(this.props.notificationID);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -24,9 +24,8 @@ class SystemUserNotificationItem extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div id="info-bar" className="d-flex justify-content-between">
|
<div id="info-bar" className="d-flex justify-content-between">
|
||||||
<span className="mr-3" aria-hidden="true"></span>
|
<span className="mr-3" aria-hidden="true"></span>
|
||||||
<p id="info-bar-info" className="m-0" dangerouslySetInnerHTML={{__html: this.props.msg}}></p>
|
<p id="info-bar-info" className="m-0" dangerouslySetInnerHTML={{ __html: this.props.msg }}></p>
|
||||||
<button className="close sf2-icon-x1" title={gettext('Close')} aria-label={gettext('Close')}
|
<button className="close sf2-icon-x1" title={gettext('Close')} aria-label={gettext('Close')} onClick={this.close}></button>
|
||||||
onClick={this.close}></button>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ class NotificationAPI {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.token = token; //none
|
this.token = token;
|
||||||
if (this.token && this.server) {
|
if (this.token && this.server) {
|
||||||
this.req = axios.create({
|
this.req = axios.create({
|
||||||
baseURL: this.server,
|
baseURL: this.server,
|
||||||
@ -37,7 +37,7 @@ class NotificationAPI {
|
|||||||
_sendPostRequest(url, form) {
|
_sendPostRequest(url, form) {
|
||||||
if (form.getHeaders) {
|
if (form.getHeaders) {
|
||||||
return this.req.post(url, form, {
|
return this.req.post(url, form, {
|
||||||
headers:form.getHeaders()
|
headers: form.getHeaders()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return this.req.post(url, form);
|
return this.req.post(url, form);
|
||||||
@ -50,8 +50,8 @@ class NotificationAPI {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setSysUserNotificationToSeen(notificationID){
|
setSysUserNotificationToSeen(notificationID) {
|
||||||
const url = this.server + 'api/v2.1/sys-user-notifications/'+notificationID+'/seen/';
|
const url = this.server + 'api/v2.1/sys-user-notifications/' + notificationID + '/seen/';
|
||||||
return this.req.put(url);
|
return this.req.put(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user