upd: penerapan firebase
Deskripsi: - pengumuman - diskusi umum - diskusi divisi - divisi - kegiatan - tugas divisi No Issues
This commit is contained in:
@@ -22,7 +22,7 @@ export async function sendFCMNotificationMany({ token, title, body, data }: { to
|
||||
title,
|
||||
body,
|
||||
},
|
||||
token,
|
||||
tokens:token,
|
||||
data,
|
||||
android: {
|
||||
priority: "high",
|
||||
@@ -42,10 +42,7 @@ export async function sendFCMNotificationMany({ token, title, body, data }: { to
|
||||
};
|
||||
|
||||
// Kirim pesan
|
||||
const response = await getMessaging().sendEachForMulticast({
|
||||
tokens: token,
|
||||
...message,
|
||||
} as any);
|
||||
const response = await getMessaging().sendEachForMulticast(message as any);
|
||||
if (response.failureCount > 0) {
|
||||
const failedTokens: any[] = [];
|
||||
response.responses.forEach((resp, idx) => {
|
||||
@@ -59,6 +56,5 @@ export async function sendFCMNotificationMany({ token, title, body, data }: { to
|
||||
return { success: true, message: "Notifikasi berhasil dikirim", };
|
||||
} catch (error) {
|
||||
console.error("Error mengirim notifikasi:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user