diff --git a/firebase.js b/firebase.js index 044a7116..7ee466eb 100644 --- a/firebase.js +++ b/firebase.js @@ -15,7 +15,7 @@ export const requestPermission = async () => { if (permission === 'granted') { const token = await getToken(messaging, { - vapidKey: process.env.NEXT_PUBLIC_VAPID_KEY, + vapidKey: "BOZ_JkC62vr767LoC7APU26ZdGYW5htBkfqIEtsVX6zmE3Fi-XgcN_TggSaXKh5rGKcaa4vuQxaYiRPU2B955GI", }); console.log('Notification token:', token); return token; diff --git a/public/firebase-messaging-sw.js b/public/firebase-messaging-sw.js index d2eff7bd..472f5d1c 100644 --- a/public/firebase-messaging-sw.js +++ b/public/firebase-messaging-sw.js @@ -2,7 +2,7 @@ importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js'); importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js'); const firebaseConfig = { - apiKey: process.env.NEXT_PUBLIC_FCM_API_KEY, + apiKey: "AIzaSyCmhNz-HMkkf42QNmnf7pnZm49FP5g4INw", authDomain: "backend-e99c8.firebaseapp.com", projectId: "backend-e99c8", storageBucket: "backend-e99c8.appspot.com", diff --git a/src/components/AllowNotification.tsx b/src/components/AllowNotification.tsx index ddf17de1..5c1da1e8 100644 --- a/src/components/AllowNotification.tsx +++ b/src/components/AllowNotification.tsx @@ -53,7 +53,7 @@ const AllowNotification = () => { try { const token = await requestPermission(); if (token && userId && authToken) { - await UpdateDeviceNotification([{ deviceId: token }], userId, { + await UpdateDeviceNotification({ deviceId: token }, userId, { tenantId, Authorization: `Bearer ${authToken}`, }); diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts index 239f60ef..26ed7d17 100644 --- a/src/services/NotificationService.ts +++ b/src/services/NotificationService.ts @@ -1,5 +1,5 @@ import { SendCredentialsRequest } from '@/utils/Interfaces'; -import { post,get } from './RestClient'; +import { post, get } from './RestClient'; import { toPascalCase } from '@/utils/Helper'; import axios from 'axios'; @@ -87,7 +87,7 @@ export const sendEmailOnLearnerCreation = async ( export const UpdateDeviceNotification = async ( - userData: { deviceId: string }[], + userData: { deviceId: string }, userId: string, headers: { tenantId: string; Authorization: string } ): Promise => { @@ -131,7 +131,7 @@ export const sendNotification = async ({ isQueue, context, key, - push + push }); return response?.data?.result; } catch (error) {