* feat: installing the app works * Update yarn.lock * feat: /api/callback now gets user auth info from basecamp * feat: updated basecamp logo * feat: added project dropdown on event apps page * feat: basecamp event creation and deletion working * feat: basecamp event rescheduling now works * refactor(CalendarService): basecamp CaldendarService code clean up * refactor: code cleanup for basecamp app API * feat: updated event summary text sent to basecamp * chore: updated basecamp images and contact info * fix: fixed typescript errors and added logic to refresh tokens on event settings * refactor(CaldendarService): used refreshAccessToken from helpers.ts instead * chore: updated basecamp description * fix: fixed incorrect import * fix: accidentally deleted props to toggle app for event * chore: updated .env.appStore.example and added README for app * Update .env.appStore.example Co-authored-by: Leo Giovanetti <hello@leog.me> * feat: added basecamp userAgent in env instead of hardcoded value * feat: updated README to include how to set basecamp user agent env * fix: removed unused import * feat: used URLSearchParams to construct url params * fix: fixed typescript errors * chore: updated README to include an example on how to set basecamp user-agent * feat: using TRPC instead of REST * chore: removed old projects REST code --------- Co-authored-by: Leo Giovanetti <hello@leog.me>
36 lines
909 B
TypeScript
36 lines
909 B
TypeScript
import type { NextApiRequest } from "next";
|
|
import { stringify } from "querystring";
|
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
|
import { defaultHandler, defaultResponder } from "@calcom/lib/server";
|
|
import prisma from "@calcom/prisma";
|
|
|
|
import { getBasecampKeys } from "../lib/getBasecampKeys";
|
|
|
|
async function handler(req: NextApiRequest) {
|
|
await prisma.user.findFirstOrThrow({
|
|
where: {
|
|
id: req.session?.user?.id,
|
|
},
|
|
select: {
|
|
id: true,
|
|
},
|
|
});
|
|
|
|
const { client_id } = await getBasecampKeys();
|
|
|
|
const params = {
|
|
type: "web_server",
|
|
client_id,
|
|
};
|
|
const query = stringify(params);
|
|
const url = `https://launchpad.37signals.com/authorization/new?${query}&redirect_uri=${
|
|
WEBAPP_URL + "/api/integrations/basecamp3/callback"
|
|
}`;
|
|
return { url };
|
|
}
|
|
|
|
export default defaultHandler({
|
|
GET: Promise.resolve({ default: defaultResponder(handler) }),
|
|
});
|