mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-05 21:32:02 -06:00
27 lines
539 B
TypeScript
27 lines
539 B
TypeScript
import { revalidateTag } from "next/cache";
|
|
|
|
interface RevalidateProps {
|
|
id?: string;
|
|
projectId?: string;
|
|
}
|
|
|
|
export const environmentCache = {
|
|
tag: {
|
|
byId(id: string) {
|
|
return `environments-${id}`;
|
|
},
|
|
byProjectId(projectId: string) {
|
|
return `projects-${projectId}-environments`;
|
|
},
|
|
},
|
|
revalidate({ id, projectId: projectId }: RevalidateProps): void {
|
|
if (id) {
|
|
revalidateTag(this.tag.byId(id));
|
|
}
|
|
|
|
if (projectId) {
|
|
revalidateTag(this.tag.byProjectId(projectId));
|
|
}
|
|
},
|
|
};
|