chore: tech debt clearing - getServerSession has a dead arg: res (#19053)
* remove res from arg list in getServerSession * remove res from all usages of getServerSession
This commit is contained in:
1 parent
15d6839985
commit
f0dc3bba17
29 files changed
+42
-45
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { LRUCache } from "lru-cache";
|
||||
import type { GetServerSidePropsContext, NextApiRequest, NextApiResponse } from "next";
|
||||
import type { GetServerSidePropsContext, NextApiRequest } from "next";
|
||||
import type { AuthOptions, Session } from "next-auth";
|
||||
import { getToken } from "next-auth/jwt";
|
||||
|
||||
@@ -30,7 +30,6 @@ const CACHE = new LRUCache<string, Session>({ max: 1000 });
|
||||
*/
|
||||
export async function getServerSession(options: {
|
||||
req: NextApiRequest | GetServerSidePropsContext["req"];
|
||||
res?: NextApiResponse | GetServerSidePropsContext["res"];
|
||||
authOptions?: AuthOptions;
|
||||
}) {
|
||||
const { req, authOptions: { secret } = {} } = options;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { getFeatureFlag } from "@calcom/features/flags/server/utils";
|
||||
import { MembershipRole } from "@calcom/prisma/client";
|
||||
|
||||
export const getServerSideProps = async ({ req, res }: GetServerSidePropsContext) => {
|
||||
export const getServerSideProps = async ({ req }: GetServerSidePropsContext) => {
|
||||
const prisma = await import("@calcom/prisma").then((mod) => mod.default);
|
||||
const organizationsEnabled = await getFeatureFlag(prisma, "organizations");
|
||||
// Check if organizations are enabled
|
||||
@@ -15,7 +15,7 @@ export const getServerSideProps = async ({ req, res }: GetServerSidePropsContext
|
||||
}
|
||||
|
||||
// Check if logged in user has an organization assigned
|
||||
const session = await getServerSession({ req, res });
|
||||
const session = await getServerSession({ req });
|
||||
|
||||
if (!session?.user.profile?.organizationId) {
|
||||
return {
|
||||
|
||||
@@ -7,9 +7,8 @@ export type PageProps = inferSSRProps<typeof getServerSidePropsForMembers>;
|
||||
|
||||
export const getServerSidePropsForMembers = async function getServerSidePropsForMembers({
|
||||
req,
|
||||
res,
|
||||
}: GetServerSidePropsContext) {
|
||||
const session = await getServerSession({ req, res });
|
||||
const session = await getServerSession({ req });
|
||||
|
||||
if (!session || !session.user) {
|
||||
return {
|
||||
|
||||
@@ -72,7 +72,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (!metadata.success) throw new HttpError({ statusCode: 400, message: "Invalid team metadata" });
|
||||
}
|
||||
|
||||
const session = await getServerSession({ req, res });
|
||||
const session = await getServerSession({ req });
|
||||
|
||||
if (!session) return { message: "Team upgraded successfully" };
|
||||
|
||||
|
||||
Reference in new issue
Block a user