diff options
notices - markAllNoticesRead - use async/await
Diffstat (limited to 'app/scripts/notice-controller.js')
-rw-r--r-- | app/scripts/notice-controller.js | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js index d1a15ff08..050fca9c8 100644 --- a/app/scripts/notice-controller.js +++ b/app/scripts/notice-controller.js @@ -58,20 +58,15 @@ module.exports = class NoticeController extends EventEmitter { } } - markAllNoticesRead (cb) { - cb = cb || function (err) { if (err) throw err } - try { - const noticeList = this.getNoticesList() - noticeList.forEach(notice => { - notice.read = true - notice.body = '' - }) - this.setNoticesList(noticeList) - const latestNotice = this.getNextUnreadNotice() - cb(null, latestNotice) - } catch (err) { - cb(err) - } + async markAllNoticesRead () { + const noticeList = this.getNoticesList() + noticeList.forEach(notice => { + notice.read = true + notice.body = '' + }) + this.setNoticesList(noticeList) + const latestNotice = this.getNextUnreadNotice() + return latestNotice } |