feat(web): improve session retrieval performance (#7584)
* feat(web): improve session retrieval performance Switch to using `getServerSession` which avoids a HTTP round trip to retrieve session details. Additionally, migrate deprecated `app/lib/auth` calls to to `@calcom/lib` package. * fix: update failing test and lint * Consolidates auth code in features * Update yarn.lock * Update packages/trpc/server/createContext.ts * Oopsie --------- Co-authored-by: zomars <[email protected]>
This commit is contained in:
1 parent
d81d772cdf
commit
2317473545
61 files changed
+1034
-956
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import type { User } from "@prisma/client";
|
||||
import CredentialsProvider from "next-auth/providers/credentials";
|
||||
import { getSession } from "next-auth/react";
|
||||
import { z } from "zod";
|
||||
|
||||
import { getSession } from "@calcom/features/auth/lib/getSession";
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
const teamIdschema = z.object({
|
||||
|
||||
@@ -3,8 +3,8 @@ import type Stripe from "stripe";
|
||||
import { z } from "zod";
|
||||
|
||||
import { getRequestedSlugError } from "@calcom/app-store/stripepayment/lib/team-billing";
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import stripe from "@calcom/features/ee/payments/server/stripe";
|
||||
import { getSession } from "@calcom/lib/auth";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { defaultHandler, defaultResponder } from "@calcom/lib/server";
|
||||
@@ -64,7 +64,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
closeComUpdateTeam(prevTeam, team);
|
||||
}
|
||||
|
||||
const session = await getSession({ req });
|
||||
const session = await getServerSession({ req, res });
|
||||
|
||||
if (!session) return { message: "Team upgraded successfully" };
|
||||
|
||||
|
||||
Reference in new issue
Block a user