Notifikasi ke admin untuk user baru mendaftar
Fix: - prisma/schema.prisma - src/app/api/auth/mobile-register/route.ts - src/app/api/mobile/admin/user/[id]/route.ts - src/app/api/mobile/notification/[id]/route.ts - src/app/api/mobile/notification/route.ts Add: Migrasi untuk db table notifikasi - prisma/migrations/20260105064508_fix_table_notifikasi_optional_data/ ### No Issue
This commit is contained in:
@@ -3,7 +3,7 @@ import { prisma } from "@/lib";
|
||||
import { adminMessaging } from "@/lib/firebase-admin";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
type NotificationProp = {
|
||||
export type NotificationProp = {
|
||||
title: string;
|
||||
body: string;
|
||||
userLoginId: string;
|
||||
@@ -134,12 +134,12 @@ export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const response = await adminMessaging.send(message);
|
||||
console.log(
|
||||
"✅ FCM sent successfully",
|
||||
"✅ FCM sent to token:",
|
||||
"Response:",
|
||||
response
|
||||
);
|
||||
} catch (error: any) {
|
||||
console.error("❌ FCM send failed:", error);
|
||||
console.error("❌ FCM send failed for token:", i.token, error);
|
||||
// Lanjutkan ke token berikutnya meski satu gagal
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user