mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 18:30:32 -06:00
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com> Co-authored-by: Johannes <johannes@formbricks.com>
26 lines
625 B
TypeScript
26 lines
625 B
TypeScript
import { revalidateTag } from "next/cache";
|
|
|
|
interface RevalidateProps {
|
|
environmentId?: string;
|
|
personId?: string;
|
|
}
|
|
|
|
export const actionCache = {
|
|
tag: {
|
|
byEnvironmentId(environmentId: string): string {
|
|
return `environments-${environmentId}-actions`;
|
|
},
|
|
byPersonId(personId: string): string {
|
|
return `environments-${personId}-actions`;
|
|
},
|
|
},
|
|
revalidate({ environmentId, personId }: RevalidateProps): void {
|
|
if (environmentId) {
|
|
revalidateTag(this.tag.byEnvironmentId(environmentId));
|
|
}
|
|
if (personId) {
|
|
revalidateTag(this.tag.byPersonId(personId));
|
|
}
|
|
},
|
|
};
|