* chore: Make app compatible with Fluid Compute * Removed isCold from me api endpoint * chore: Remove handler caching for Fluid Compute compatibility (#20692) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: keith@cal.com <keith@cal.com> * fix client_id issue * chore: Remove UNSTABLE_HANDLER_CACHE for Fluid Compute compatibility (#20694) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: keith@cal.com <keith@cal.com> * Fixing types * Fixing type issues * chore: Remove importHandler references for Fluid Compute compatibility Co-Authored-By: keith@cal.com <keith@cal.com> * chore: Remove importHandler references from attributes router for Fluid Compute compatibility Co-Authored-By: keith@cal.com <keith@cal.com> --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: keith@cal.com <keith@cal.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import type { NextApiRequest, NextApiResponse } from "next";
|
|
import { stringify } from "querystring";
|
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
|
import prisma from "@calcom/prisma";
|
|
|
|
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
if (req.method === "GET") {
|
|
// Get user
|
|
await prisma.user.findFirstOrThrow({
|
|
where: {
|
|
id: req.session?.user?.id,
|
|
},
|
|
select: {
|
|
id: true,
|
|
},
|
|
});
|
|
|
|
let clientId = "";
|
|
let baseUrl = "";
|
|
const appKeys = await getAppKeysFromSlug("tandem");
|
|
if (typeof appKeys.client_id === "string") clientId = appKeys.client_id;
|
|
if (typeof appKeys.base_url === "string") baseUrl = appKeys.base_url;
|
|
if (!clientId) return res.status(400).json({ message: "Tandem client_id missing." });
|
|
if (!baseUrl) return res.status(400).json({ message: "Tandem base_url missing." });
|
|
|
|
const redirect_uri = encodeURI(`${WEBAPP_URL}/api/integrations/tandemvideo/callback`);
|
|
|
|
const params = {
|
|
client_id: clientId,
|
|
redirect_uri,
|
|
};
|
|
const query = stringify(params);
|
|
const url = `${baseUrl}/oauth/approval?${query}`;
|
|
res.status(200).json({ url });
|
|
}
|
|
}
|