Skip to content

Scheduling infrastructure for absolutely everyone.

fix: redir parameter for connect atoms (#22815)

Rajiv Sahaldc967cffbecd
diff --git a/.changeset/short-foxes-crash.md b/.changeset/short-foxes-crash.md
new file mode 100644
index 00000000000..a7b452fe8f5
--- /dev/null
+++ b/.changeset/short-foxes-crash.md
@@ -0,0 +1,6 @@
+---
+"@calcom/atoms": patch
+---
+
+This change fixes an issue in the CalendarSettings atom where the redirect urls were getting only one search param
+
diff --git a/packages/platform/atoms/hooks/connect/useConnect.ts b/packages/platform/atoms/hooks/connect/useConnect.ts
index fe261c2bf47..bff70c92bd0 100644
--- a/packages/platform/atoms/hooks/connect/useConnect.ts
+++ b/packages/platform/atoms/hooks/connect/useConnect.ts
@@ -18,6 +18,8 @@ export const useGetRedirectUrl = (
redir?: string,
isDryRun?: boolean
) => {
+ const redirectUrl = !!redir ? encodeURIComponent(redir) : "";
+
const authUrl = useQuery({
queryKey: getQueryKey(calendar),
staleTime: Infinity,
@@ -25,7 +27,7 @@ export const useGetRedirectUrl = (
queryFn: () => {
return http
?.get<ApiResponse<{ authUrl: string }>>(
- `/calendars/${calendar}/connect?redir=${redir ?? ""}&isDryRun=${isDryRun ?? ""}`
+ `/calendars/${calendar}/connect?redir=${redirectUrl}&isDryRun=${isDryRun ?? ""}`
)
.then(({ data: responseBody }) => {
if (responseBody.status === SUCCESS_STATUS) {