master^2
Bhaskar 7 months ago
parent 542235150d
commit 7766665de3

@ -2181,11 +2181,11 @@ const sendNotification = async (hw_Id, customerId, fcmIds, title, body) => {
console.log(`✅ Notification sent successfully to token: ${token}`); console.log(`✅ Notification sent successfully to token: ${token}`);
console.log("📬 FCM Response:", response); console.log("📬 FCM Response:", response);
console.log(`📡 Sending notification to Customer ID: ${customerId}`); console.log(`📡 Sending notification to Customer ID: ${customerId}`);
console.log(`🔍 FCM Tokens:`, fcmTokens); //console.log(`🔍 FCM Tokens:`, fcmTokens);
} catch (error) { } catch (error) {
console.error(`❌ Failed to send notification to token: ${token}`, error); // console.error(`❌ Failed to send notification to token: ${token}`, error);
if (error.code === "messaging/registration-token-not-registered") { if (error.code === "messaging/registration-token-not-registered") {
await User.updateOne({ customerId }, { $pull: { fcmIds: token } }); await User.updateOne({ customerId }, { $pull: { fcmIds: token } });

Loading…
Cancel
Save