add handling for error and successful return

This commit is contained in:
2025-02-03 22:42:25 -08:00
parent c5c0208371
commit 103ddef523

View File

@@ -111,10 +111,12 @@ export class NotificationService {
}); });
const json = await response.json(); const json = await response.json();
// Check whether it was successful if (response.status !== 200) {
// Return the result console.error(`Notification failed for device ${deviceId}:`, json.reason);
return false; return false;
} }
return true;
}
private getAPNsFullUrlToUse(deviceId: string) { private getAPNsFullUrlToUse(deviceId: string) {
// Construct the fetch request // Construct the fetch request