mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-24 18:59:22 -06:00
Co-authored-by: Dhruwang <dhruwangjariwala18@gmail.com> Co-authored-by: Matthias Nannt <mail@matthiasnannt.com> Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
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));
|
|
}
|
|
},
|
|
};
|