|
|
|
@ -2181,11 +2181,11 @@ const sendNotification = async (hw_Id, customerId, fcmIds, title, body) => {
|
|
|
|
|
console.log(`✅ Notification sent successfully to token: ${token}`);
|
|
|
|
|
console.log("📬 FCM Response:", response);
|
|
|
|
|
console.log(`📡 Sending notification to Customer ID: ${customerId}`);
|
|
|
|
|
console.log(`🔍 FCM Tokens:`, fcmTokens);
|
|
|
|
|
//console.log(`🔍 FCM Tokens:`, fcmTokens);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} 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") {
|
|
|
|
|
await User.updateOne({ customerId }, { $pull: { fcmIds: token } });
|
|
|
|
|