mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-31 02:40:31 -06:00
27 lines
539 B
TypeScript
27 lines
539 B
TypeScript
import { revalidateTag } from "next/cache";
|
|
|
|
interface RevalidateProps {
|
|
id?: string;
|
|
responseId?: string;
|
|
}
|
|
|
|
export const responseNoteCache = {
|
|
tag: {
|
|
byId(id: string) {
|
|
return `responseNotes-${id}`;
|
|
},
|
|
byResponseId(responseId: string) {
|
|
return `responses-${responseId}-responseNote`;
|
|
},
|
|
},
|
|
revalidate({ id, responseId }: RevalidateProps): void {
|
|
if (id) {
|
|
revalidateTag(this.tag.byId(id));
|
|
}
|
|
|
|
if (responseId) {
|
|
revalidateTag(this.tag.byResponseId(responseId));
|
|
}
|
|
},
|
|
};
|