Skip to content

Commit dfd5cc2

Browse files
authored
Merge pull request joincalldotco#157 from joincalldotco/revert-156-fix/redirection-issues
Revert "Fix/redirection issues"
2 parents b88246e + e754577 commit dfd5cc2

File tree

5 files changed

+15
-71
lines changed

5 files changed

+15
-71
lines changed

apps/web/app/(app)/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const AppLayout = async ({ children }: { children: React.ReactNode }) => {
99
headers: await headers(),
1010
});
1111

12-
if (!session) redirect("/login");
12+
// if (!session) redirect("/login");
13+
if (!session) return null;
1314
return <SessionProvider value={session}>{children}</SessionProvider>;
1415
};
1516

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function CreateTeamModal({ onClose, onTeamCreated }: {
3838

3939
const fetchContacts = async () => {
4040
try {
41-
const res = await fetch(`${process.env.BACKEND_URL}/api/contacts`, {
41+
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/contacts`, {
4242
credentials: "include",
4343
});
4444
if (res.ok) {
@@ -87,7 +87,7 @@ export function CreateTeamModal({ onClose, onTeamCreated }: {
8787
members: selectedMembers,
8888
};
8989

90-
const res = await fetch(`${process.env.BACKEND_URL}/api/teams/create`, {
90+
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/teams/create`, {
9191
method: "POST",
9292
headers: {
9393
"Content-Type": "application/json",

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

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -50,55 +50,18 @@ export const TeamSection = () => {
5050
},
5151
});
5252

53-
54-
// Prevent hydration mismatch
55-
useEffect(() => {
56-
setMounted(true);
57-
}, []);
58-
59-
const startTeamMeeting = async (team: Team) => {
60-
try {
61-
setStartingMeeting(team.id);
62-
const res = await fetch(`${process.env.BACKEND_URL}/api/calls/create`, {
63-
method: "POST",
64-
headers: { "Content-Type": "application/json" },
65-
credentials: "include",
66-
body: JSON.stringify({
67-
name: `${team.name} Meeting`,
68-
members: team.members.map((m) => m.email),
69-
teamId: team.id,
70-
}),
53+
const { mutate: createCall, isPending: createCallPending } = useMutation({
54+
mutationFn: CALLS_QUERY.createCall,
55+
onSuccess: (data) => {
56+
toast.success("Call created successfully", {
57+
description: "Redirecting to call...",
7158
});
7259
router.push(`/app/call/${data.callId}`);
73-
74-
} catch (err) {
75-
alert("Network error starting meeting");
76-
} finally {
77-
setStartingMeeting(null);
78-
}
79-
};
80-
81-
// Fetch contacts only when modal opens
82-
useEffect(() => {
83-
if (addUsersOpen) {
84-
fetch(`${process.env.BACKEND_URL}/api/contacts`, { credentials: "include" })
85-
.then(res => res.json())
86-
.then(data => setContacts(data.contacts || []));
87-
}
88-
}, [addUsersOpen]);
89-
90-
const handleAddUsers = async () => {
91-
if (!addUsersOpen) return;
92-
setAddLoading(true);
93-
setAddError(null);
94-
try {
95-
const res = await fetch(`${process.env.BACKEND_URL}/api/teams/${addUsersOpen}/add-members`, {
96-
method: "POST",
97-
headers: { "Content-Type": "application/json" },
98-
credentials: "include",
99-
body: JSON.stringify({ emails: selectedContacts }),
100-
});
101-
60+
},
61+
onError: (error) => {
62+
toast.error("Failed to create call");
63+
},
64+
});
10265

10366
const startTeamMeeting = async (team: Team) => {
10467
createCall({

packages/auth/src/auth-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createAuthClient } from "better-auth/react";
22

33
export const authClient = createAuthClient({
4-
baseURL: process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:1284",
4+
baseURL: process.env.BACKEND_URL,
55
});

packages/auth/src/auth.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,6 @@ export const auth = betterAuth({
2929

3030
trustedOrigins: [process.env.FRONTEND_URL, process.env.BACKEND_URL],
3131

32-
// Add cookie configuration for cross-domain support
33-
session: {
34-
cookieCache: {
35-
enabled: true,
36-
maxAge: 60 * 60 * 24 * 7, // 7 days
37-
},
38-
},
39-
40-
// Cookie configuration for cross-domain
41-
cookies: {
42-
sessionToken: {
43-
name: "better-auth.session-token",
44-
httpOnly: true,
45-
secure: process.env.NODE_ENV === "production",
46-
sameSite: process.env.NODE_ENV === "production" ? "none" : "lax",
47-
domain: process.env.NODE_ENV === "production" ? ".joincall.co" : undefined,
48-
maxAge: 60 * 60 * 24 * 7, // 7 days
49-
},
50-
},
51-
5232
emailAndPassword: {
5333
enabled: true,
5434
autoSignIn: true,

0 commit comments

Comments
 (0)