upd: coba fcm server
This commit is contained in:
@@ -5,6 +5,7 @@ import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import "moment/locale/id";
|
||||
import { NextResponse } from "next/server";
|
||||
import { sendFCMNotification } from "../../../../../xsend";
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
|
||||
@@ -99,6 +100,8 @@ export async function GET(request: Request) {
|
||||
createdAt: moment(v.createdAt).format("ll")
|
||||
}))
|
||||
|
||||
await sendFCMNotification('c89yuexsS_uc1tOErVPu5a:APA91bEb6tEKXAfReZjFVJ2mMyOzoW_RXryLSnSJTpbIVV3G0L_DCNkLuRvJ02Ip-Erz88QCQBAt-C2SN8eCRxu3-v1sBzXzKPtDv-huXpkjXsyrkifqvUo')
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan pengumuman", data: allData, }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
return NextResponse.json({ success: true, version: "1.5.1", tahap: "beta", update: "-percobaan firebase admin fcm" }, { status: 200 });
|
||||
return NextResponse.json({ success: true, version: "1.5.2", tahap: "beta", update: "-percobaan firebase admin fcm" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||
|
||||
4
xsend.ts
4
xsend.ts
@@ -19,8 +19,8 @@ export async function sendFCMNotification(token: string) {
|
||||
// Konfigurasi pesan
|
||||
const message = {
|
||||
notification: {
|
||||
title: "Judul Notifikasi pake encrypt",
|
||||
body: "Ini adalah isi notifikasi key diencrypt",
|
||||
title: "Notifikasi Encrypted api",
|
||||
body: "Ini adalah isi notifikasi key diencrypt dan api",
|
||||
},
|
||||
token,
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user