fix: send FCM token to User/SetFCMToken endpoint
All checks were successful
Build frontend / build (push) Successful in 43s
All checks were successful
Build frontend / build (push) Successful in 43s
This commit is contained in:
@ -50,13 +50,13 @@ export async function requestNotificationPermission() {
|
|||||||
const authToken = localStorage.getItem("auth_token");
|
const authToken = localStorage.getItem("auth_token");
|
||||||
if (authToken) {
|
if (authToken) {
|
||||||
const apiBase = process.env.NEXT_PUBLIC_API_URL || "http://45.93.137.91/api";
|
const apiBase = process.env.NEXT_PUBLIC_API_URL || "http://45.93.137.91/api";
|
||||||
await fetch(`${apiBase}/Notifications/RegisterWebToken`, {
|
await fetch(`${apiBase}/User/SetFCMToken`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: `Bearer ${authToken}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ token }),
|
body: JSON.stringify({ token, deviceType: 2 }), // 2 = Web
|
||||||
});
|
});
|
||||||
console.log("[FCM] Token sent to backend");
|
console.log("[FCM] Token sent to backend");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user