Revalidate calendar cache when user change de selected calendars-
This commit is contained in:
parent
a0c81eba88
commit
fb2412b5ce
|
@ -1,4 +1,5 @@
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
import { revalidateCalendarCache } from "pages/api/revalidate-calendar-cache/[username]";
|
||||||
|
|
||||||
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/core/CalendarManager";
|
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/core/CalendarManager";
|
||||||
import notEmpty from "@calcom/lib/notEmpty";
|
import notEmpty from "@calcom/lib/notEmpty";
|
||||||
|
@ -65,6 +66,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
res.status(200).json({ message: "Calendar Selection Saved" });
|
res.status(200).json({ message: "Calendar Selection Saved" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (["DELETE", "POST"].includes(req.method)) {
|
||||||
|
await revalidateCalendarCache(res.revalidate, `${session?.user?.username}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (req.method === "GET") {
|
if (req.method === "GET") {
|
||||||
const selectedCalendarIds = await prisma.selectedCalendar.findMany({
|
const selectedCalendarIds = await prisma.selectedCalendar.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user