fix : firebase
Deskripsi : - fix error emty token firebase NO Issues
This commit is contained in:
@@ -22,7 +22,7 @@ export async function sendFCMNotificationMany({ token, title, body, data }: { to
|
||||
title,
|
||||
body,
|
||||
},
|
||||
tokens:token,
|
||||
tokens: token,
|
||||
data,
|
||||
android: {
|
||||
priority: "high",
|
||||
@@ -44,6 +44,7 @@ export async function sendFCMNotificationMany({ token, title, body, data }: { to
|
||||
},
|
||||
};
|
||||
|
||||
if (token.length > 0) {
|
||||
// Kirim pesan
|
||||
const response = await getMessaging().sendEachForMulticast(message as any);
|
||||
if (response.failureCount > 0) {
|
||||
@@ -56,6 +57,9 @@ export async function sendFCMNotificationMany({ token, title, body, data }: { to
|
||||
const del = await deleteDeviceError({ device: failedTokens });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return { success: true, message: "Notifikasi berhasil dikirim", };
|
||||
} catch (error) {
|
||||
console.error("Error mengirim notifikasi:", error);
|
||||
|
||||
Reference in New Issue
Block a user