revalidate event type page on update (#7685)

This commit is contained in:
Efraín Rochín
2023-03-20 11:21:14 +00:00
committed by GitHub
parent ee8b2e67f0
commit 5d7685f2c0
@@ -2,6 +2,7 @@ import { MembershipRole, PeriodType, Prisma, SchedulingType } from "@prisma/clie
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";
// REVIEW: From lint error
import _ from "lodash";
import type { NextApiResponse } from "next";
import { z } from "zod";
import getAppKeysFromSlug from "@calcom/app-store/_utils/getAppKeysFromSlug";
@@ -700,7 +701,10 @@ export const eventTypesRouter = router({
where: { id },
data,
});
const res = ctx.res as NextApiResponse;
if (typeof res?.revalidate !== "undefined") {
await res?.revalidate(`/${ctx.user.username}/${eventType.slug}`);
}
return { eventType };
}),
delete: eventOwnerProcedure