From d18914066b64ef9a7bca1238f128ff6400074e36 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 30 Mar 2020 15:06:30 +0200 Subject: [PATCH] Simplify method --- src/helpers/NotificationsHelper.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/helpers/NotificationsHelper.ts b/src/helpers/NotificationsHelper.ts index eb4a549..8232c27 100644 --- a/src/helpers/NotificationsHelper.ts +++ b/src/helpers/NotificationsHelper.ts @@ -317,15 +317,10 @@ export class NotificationsHelper { */ public static async Delete(n: Notif) { // Delete a specific notification - if(n.hasId) - await DatabaseHelper.DeleteRows(NOTIFICATIONS_TABLE, { - id: n.id - }) - - // Delete wider range of notifications - else - await DatabaseHelper.DeleteRows(NOTIFICATIONS_TABLE, this.NotifToDB(n, false)) + const cond = n.hasId ? {id: n.id} : this.NotifToDB(n, false); + // Delete notifications + await DatabaseHelper.DeleteRows(NOTIFICATIONS_TABLE, cond); } /**