Skip to content

Commit 40e4fb4

Browse files
authored
Merge branch 'main' into main
2 parents 1e119bb + dfd5cc2 commit 40e4fb4

File tree

12 files changed

+58
-59
lines changed

12 files changed

+58
-59
lines changed

apps/web/app/(app)/app/call/[id]/page.tsx

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,16 @@ interface RemoteStream {
273273

274274
const recordCallParticipation = async (callId: string) => {
275275
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+
287286
} catch (error) {
288287
console.error("Error recording call participation:", error);
289288
}
@@ -324,8 +323,10 @@ export default function CallPreviewPage() {
324323
const fetchCreatorInfo = async () => {
325324
try {
326325
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+
329330
credentials: "include",
330331
}
331332
);
@@ -349,7 +350,7 @@ export default function CallPreviewPage() {
349350
const checkAccess = async () => {
350351
try {
351352
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`,
353354
{
354355
credentials: "include",
355356
}
@@ -380,7 +381,7 @@ export default function CallPreviewPage() {
380381
setIsRequestingAccess(true);
381382
try {
382383
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`,
384385
{
385386
method: "POST",
386387
headers: {
@@ -942,17 +943,16 @@ export default function CallPreviewPage() {
942943
const handleHangup = useCallback(async () => {
943944
try {
944945
// 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+
956956
} catch (error) {
957957
console.error("Failed to record call leave:", error);
958958
// Continue with hangup even if recording fails
@@ -1013,17 +1013,16 @@ export default function CallPreviewPage() {
10131013
// Record that the user is leaving the call if they were joined
10141014
if (joined) {
10151015
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+
10271026
} catch (error) {
10281027
console.error("Failed to record call leave on cleanup:", error);
10291028
}
@@ -1050,7 +1049,7 @@ export default function CallPreviewPage() {
10501049
// For synchronous operation during page unload
10511050
if (joined) {
10521051
navigator.sendBeacon(
1053-
`http://${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/record-leave`,
1052+
`${process.env.BACKEND_URL}/api/calls/record-leave`,
10541053
JSON.stringify({ callId })
10551054
);
10561055
}

apps/web/components/app/section/_components/call-history.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function CallHistory() {
7575

7676
// // setIsDeleting(true);
7777
// try {
78-
// const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/participated`, {
78+
// const res = await fetch(`${process.env.BACKEND_URL}/api/calls/participated`, {
7979
// method: "DELETE",
8080
// credentials: "include",
8181
// });
@@ -106,7 +106,7 @@ export function CallHistory() {
106106

107107
// try {
108108
// const res = await fetch(
109-
// `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/participated/${callId}`,
109+
// `${process.env.BACKEND_URL}/api/calls/participated/${callId}`,
110110
// {
111111
// method: "DELETE",
112112
// credentials: "include",

apps/web/components/app/section/_components/create-call-modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ export function CreateCallModal({
4848
}
4949
setLoading(true);
5050
try {
51-
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/create`, {
51+
const res = await fetch(`${process.env.BACKEND_URL}/api/calls/create`, {
5252
method: "POST",
5353
headers: { "Content-Type": "application/json" },
5454
credentials: "include",
5555
body: JSON.stringify({
5656
name: meetingName.trim(),
5757
members: selectedMembers.length > 0 ? selectedMembers : undefined,
58-
}),
58+
}),
5959
});
6060
const data = await res.json();
6161
console.log("🔍 [CALLS DEBUG] Response:", data);

apps/web/components/app/section/_components/modal-contact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function ModalContact({ onClose }: { onClose?: () => void }) {
2828
}
2929
setLoading(true);
3030
try {
31-
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/contacts/invite`, {
31+
const res = await fetch(`${process.env.BACKEND_URL}/api/contacts/invite`, {
3232
method: "POST",
3333
headers: {
3434
"Content-Type": "application/json",

apps/web/components/app/section/_components/team-switcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function TeamSwitcher() {
4444

4545
try {
4646
setLoading(true);
47-
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/teams`, {
47+
const res = await fetch(`${process.env.BACKEND_URL}/api/teams`, {
4848
credentials: "include",
4949
});
5050

apps/web/components/app/section/contacts-list.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function ContactsList() {
2121
setLoading(true);
2222
setError(null);
2323
try {
24-
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/contacts`, {
24+
const res = await fetch(`${process.env.BACKEND_URL}/api/contacts`, {
2525
credentials: "include",
2626
});
2727
if (!res.ok) throw new Error("Failed to fetch contacts");
@@ -39,7 +39,7 @@ export default function ContactsList() {
3939

4040
try {
4141
setDeletingContact(contactId);
42-
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/contacts/${contactId}`, {
42+
const res = await fetch(`${process.env.BACKEND_URL}/api/contacts/${contactId}`, {
4343
method: "DELETE",
4444
credentials: "include",
4545
});

apps/web/components/app/section/notification-section.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ const NotificationSection = () => {
4646
try {
4747
// Fetch both call notifications and contact requests
4848
const [notificationsRes, contactRequestsRes] = await Promise.all([
49-
fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/notifications`, {
49+
fetch(`${process.env.BACKEND_URL}/api/notifications`, {
5050
credentials: "include",
5151
}),
52-
fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/contacts/requests`, {
52+
fetch(`${process.env.BACKEND_URL}/api/contacts/requests`, {
5353
credentials: "include",
5454
}),
5555
]);
@@ -104,7 +104,7 @@ const NotificationSection = () => {
104104
setActionLoading(invitationId);
105105
try {
106106
const res = await fetch(
107-
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/invitations/${invitationId}/accept`,
107+
`${process.env.BACKEND_URL}/api/calls/invitations/${invitationId}/accept`,
108108
{
109109
method: "PATCH",
110110
credentials: "include",
@@ -128,7 +128,7 @@ const NotificationSection = () => {
128128
setActionLoading(invitationId);
129129
try {
130130
const res = await fetch(
131-
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/invitations/${invitationId}/reject`,
131+
`${process.env.BACKEND_URL}/api/calls/invitations/${invitationId}/reject`,
132132
{
133133
method: "PATCH",
134134
credentials: "include",
@@ -157,7 +157,7 @@ const NotificationSection = () => {
157157
setActionLoading(requestId);
158158
try {
159159
const res = await fetch(
160-
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/contacts/requests/${requestId}/${action}`,
160+
`${process.env.BACKEND_URL}/api/contacts/requests/${requestId}/${action}`,
161161
{
162162
method: "PATCH",
163163
credentials: "include",

apps/web/components/rooms/participants-sidebar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function ParticipantsSidebar({
6565

6666
const fetchJoinRequests = async () => {
6767
try {
68-
const response = await fetch(`http://${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/${callId}/join-requests`, {
68+
const response = await fetch(`${process.env.BACKEND_URL}/api/calls/${callId}/join-requests`, {
6969
credentials: "include",
7070
});
7171

@@ -88,7 +88,7 @@ export function ParticipantsSidebar({
8888
const handleApproveRequest = async (userId: string) => {
8989
setLoading(true);
9090
try {
91-
const response = await fetch(`http://${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/${callId}/approve-join`, {
91+
const response = await fetch(`${process.env.BACKEND_URL}/api/calls/${callId}/approve-join`, {
9292
method: "POST",
9393
headers: {
9494
"Content-Type": "application/json",
@@ -115,7 +115,7 @@ export function ParticipantsSidebar({
115115
const handleRejectRequest = async (userId: string) => {
116116
setLoading(true);
117117
try {
118-
const response = await fetch(`http://${process.env.NEXT_PUBLIC_BACKEND_URL}/api/calls/${callId}/reject-join`, {
118+
const response = await fetch(`${process.env.BACKEND_URL}/api/calls/${callId}/reject-join`, {
119119
method: "POST",
120120
headers: {
121121
"Content-Type": "application/json",

apps/web/lib/api-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from "axios";
22

33
export const apiClient = axios.create({
4-
baseURL: `http://${process.env.NEXT_PUBLIC_BACKEND_URL}/api`,
4+
baseURL: `${process.env.BACKEND_URL}/api`,
55
headers: {},
66
withCredentials: true,
77
});

apps/web/lib/create-request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function createRequest({
2626
const query = queryString ? `?${queryString}` : "";
2727

2828
// Construct the full URL
29-
const fullUrl = `${process.env.NEXT_PUBLIC_BACKEND_URL}/api${currentPath}${query}`;
29+
const fullUrl = `${process.env.BACKEND_URL}/api${currentPath}${query}`;
3030

3131
return fetch(fullUrl, { signal, credentials: "include" });
3232
};

0 commit comments

Comments
 (0)