Compare commits

..

1 Commits

Author SHA1 Message Date
1b206102b0 Fix API Notifikasi
### No Issue
2026-01-05 14:04:08 +08:00

View File

@@ -108,10 +108,40 @@ export async function POST(request: NextRequest) {
deepLink: deepLink || "", deepLink: deepLink || "",
// contoh: senderId, type, etc. // contoh: senderId, type, etc.
}, },
// Konfigurasi Android untuk prioritas tinggi
android: {
priority: "high" as const, // Kirim secepatnya, bahkan di doze mode untuk notifikasi penting
notification: {
channelId: "default", // Sesuaikan dengan channel yang kamu buat di Android
// Opsional: sesuaikan icon & warna
// icon: 'ic_notification',
// color: '#FFD700',
},
// FCM akan bangunkan app jika perlu
ttl: 0 as const, // Kirim secepatnya, jangan tunda
},
// Opsional: tambahkan untuk iOS juga
apns: {
payload: {
aps: {
sound: "default" as const,
// 'content-available': 1 as const, // jika butuh silent push
},
},
},
}; };
const response = await adminMessaging.send(message); try {
console.log("✅ FCM sent:", response); const response = await adminMessaging.send(message);
console.log(
"✅ FCM sent successfully",
"Response:",
response
);
} catch (error: any) {
console.error("❌ FCM send failed:", error);
// Lanjutkan ke token berikutnya meski satu gagal
}
} }
} else { } else {
return NextResponse.json({ return NextResponse.json({