From 103ddef523473e07457e9c44fca6890c7a9b07ad Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 3 Feb 2025 22:42:25 -0800 Subject: [PATCH] add handling for error and successful return --- src/services/NotificationService.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts index 7e6ec1e..defd0f0 100644 --- a/src/services/NotificationService.ts +++ b/src/services/NotificationService.ts @@ -111,9 +111,11 @@ export class NotificationService { }); const json = await response.json(); - // Check whether it was successful - // Return the result - return false; + if (response.status !== 200) { + console.error(`Notification failed for device ${deviceId}:`, json.reason); + return false; + } + return true; } private getAPNsFullUrlToUse(deviceId: string) {