Skip to content

Commit 9f83631

Browse files
Use toggleElem
Co-authored-by: wxiaoguang <[email protected]>
1 parent ef8ffcf commit 9f83631

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

web_src/js/features/notification.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import $ from 'jquery';
22
import {GET} from '../modules/fetch.js';
3-
import {hideElem, showElem} from '../utils/dom.js';
3+
import {toggleElem} from '../utils/dom.js';
44

55
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
66
let notificationSequenceNumber = 0;
@@ -178,11 +178,7 @@ async function updateNotificationCount() {
178178

179179
const data = await response.json();
180180

181-
if (data.new === 0) {
182-
hideElem('.notification_count');
183-
} else {
184-
showElem('.notification_count');
185-
}
181+
toggleElem('.notification_count', data.new !== 0);
186182

187183
for (const el of document.getElementsByClassName('notification_count')) {
188184
el.textContent = `${data.new}`;

0 commit comments

Comments
 (0)