@@ -273,17 +273,16 @@ interface RemoteStream {
273
273
274
274
const recordCallParticipation = async ( callId : string ) => {
275
275
try {
276
- await fetch (
277
- `http://${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/record-participation` ,
278
- {
279
- method : "POST" ,
280
- headers : {
281
- "Content-Type" : "application/json" ,
282
- } ,
283
- credentials : "include" ,
284
- body : JSON . stringify ( { callId } ) ,
285
- }
286
- ) ;
276
+
277
+ await fetch ( `${ process . env . BACKEND_URL } /api/calls/record-participation` , {
278
+ method : "POST" ,
279
+ headers : {
280
+ "Content-Type" : "application/json" ,
281
+ } ,
282
+ credentials : "include" ,
283
+ body : JSON . stringify ( { callId } ) ,
284
+ } ) ;
285
+
287
286
} catch ( error ) {
288
287
console . error ( "Error recording call participation:" , error ) ;
289
288
}
@@ -324,8 +323,10 @@ export default function CallPreviewPage() {
324
323
const fetchCreatorInfo = async ( ) => {
325
324
try {
326
325
const response = await fetch (
327
- `http://${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/${ callId } /creator` ,
328
- {
326
+
327
+ `${ process . env . BACKEND_URL } /api/calls/${ callId } /creator` ,
328
+ {
329
+
329
330
credentials : "include" ,
330
331
}
331
332
) ;
@@ -349,7 +350,7 @@ export default function CallPreviewPage() {
349
350
const checkAccess = async ( ) => {
350
351
try {
351
352
const response = await fetch (
352
- `http:// ${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/${ callId } /check-access` ,
353
+ `${ process . env . BACKEND_URL } /api/calls/${ callId } /check-access` ,
353
354
{
354
355
credentials : "include" ,
355
356
}
@@ -380,7 +381,7 @@ export default function CallPreviewPage() {
380
381
setIsRequestingAccess ( true ) ;
381
382
try {
382
383
const response = await fetch (
383
- `http:// ${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/${ callId } /request-join`,
384
+ ` ${ process . env . BACKEND_URL } /api/calls/${ callId } /request-join`,
384
385
{
385
386
method : "POST" ,
386
387
headers : {
@@ -942,17 +943,16 @@ export default function CallPreviewPage() {
942
943
const handleHangup = useCallback ( async ( ) => {
943
944
try {
944
945
// Record that the user is leaving the call
945
- await fetch (
946
- `http://${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/record-leave` ,
947
- {
948
- method : "POST" ,
949
- headers : {
950
- "Content-Type" : "application/json" ,
951
- } ,
952
- credentials : "include" ,
953
- body : JSON . stringify ( { callId } ) ,
954
- }
955
- ) ;
946
+
947
+ await fetch ( `${ process . env . BACKEND_URL } /api/calls/record-leave` , {
948
+ method : "POST" ,
949
+ headers : {
950
+ "Content-Type" : "application/json" ,
951
+ } ,
952
+ credentials : "include" ,
953
+ body : JSON . stringify ( { callId } ) ,
954
+ } ) ;
955
+
956
956
} catch ( error ) {
957
957
console . error ( "Failed to record call leave:" , error ) ;
958
958
// Continue with hangup even if recording fails
@@ -1013,17 +1013,16 @@ export default function CallPreviewPage() {
1013
1013
// Record that the user is leaving the call if they were joined
1014
1014
if ( joined ) {
1015
1015
try {
1016
- await fetch (
1017
- `http://${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/record-leave` ,
1018
- {
1019
- method : "POST" ,
1020
- headers : {
1021
- "Content-Type" : "application/json" ,
1022
- } ,
1023
- credentials : "include" ,
1024
- body : JSON . stringify ( { callId } ) ,
1025
- }
1026
- ) ;
1016
+
1017
+ await fetch ( `${ process . env . BACKEND_URL } /api/calls/record-leave` , {
1018
+ method : "POST" ,
1019
+ headers : {
1020
+ "Content-Type" : "application/json" ,
1021
+ } ,
1022
+ credentials : "include" ,
1023
+ body : JSON . stringify ( { callId } ) ,
1024
+ } ) ;
1025
+
1027
1026
} catch ( error ) {
1028
1027
console . error ( "Failed to record call leave on cleanup:" , error ) ;
1029
1028
}
@@ -1050,7 +1049,7 @@ export default function CallPreviewPage() {
1050
1049
// For synchronous operation during page unload
1051
1050
if ( joined ) {
1052
1051
navigator . sendBeacon (
1053
- `http:// ${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/calls/record-leave` ,
1052
+ `${ process . env . BACKEND_URL } /api/calls/record-leave` ,
1054
1053
JSON . stringify ( { callId } )
1055
1054
) ;
1056
1055
}
0 commit comments