From d1b7bfda4b0ed12a807980b55eefd8d095756af1 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Tue, 28 Jan 2020 23:36:28 +0100 Subject: [PATCH] Add System::jsonExit() --- src/Module/Notifications/Notification.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Module/Notifications/Notification.php b/src/Module/Notifications/Notification.php index b8d0e47f01..6df58374ec 100644 --- a/src/Module/Notifications/Notification.php +++ b/src/Module/Notifications/Notification.php @@ -46,14 +46,11 @@ class Notification extends BaseModule try { $success = DI::notify()->setAllSeen(); }catch (\Exception $e) { + DI::logger()->warning('set all seen failed.', ['exception' => $e]); $success = false; } - header('Content-type: application/json; charset=utf-8'); - echo json_encode([ - 'result' => ($success) ? 'success' : 'fail', - ]); - exit(); + System::jsonExit(['result' => (($success) ? 'success' : 'fail')]); } } @@ -83,7 +80,6 @@ class Notification extends BaseModule DI::baseUrl()->redirect(); } - // @TODO: Replace with parameter from router DI::baseUrl()->redirect('notifications/system'); } }