From f73e3240d2607c3e2fce5cf323ef20f7470bed7c Mon Sep 17 00:00:00 2001 From: Emanuele Dall'Ara <71103219+LeleDallas@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:15:20 +0100 Subject: [PATCH] refactor: removed useless nested fold --- src/features/payments/routers/notices.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/features/payments/routers/notices.ts b/src/features/payments/routers/notices.ts index 4a8f8e95..f2839e4c 100644 --- a/src/features/payments/routers/notices.ts +++ b/src/features/payments/routers/notices.ts @@ -96,14 +96,10 @@ addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => { O.fromNullable, O.fold( () => res.sendStatus(400), - eventId => - pipe( - O.fromNullable(NoticesDB.removeUserNotice(eventId)), - O.fold( - () => res.sendStatus(hideReceiptResponseCode), - () => res.sendStatus(hideReceiptResponseCode) - ) - ) + eventId => { + NoticesDB.removeUserNotice(eventId); + return res.sendStatus(hideReceiptResponseCode); + } ) ); });