mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-02 11:30:31 -05:00
3bb6ce3250
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
27 lines
475 B
TypeScript
27 lines
475 B
TypeScript
import { revalidateTag } from "next/cache";
|
|
|
|
interface RevalidateProps {
|
|
id?: string;
|
|
email?: string;
|
|
}
|
|
|
|
export const profileCache = {
|
|
tag: {
|
|
byId(id: string) {
|
|
return `profiles-${id}`;
|
|
},
|
|
byEmail(email: string) {
|
|
return `profiles-${email}`;
|
|
},
|
|
},
|
|
revalidate({ id, email }: RevalidateProps): void {
|
|
if (id) {
|
|
revalidateTag(this.tag.byId(id));
|
|
}
|
|
|
|
if (email) {
|
|
revalidateTag(this.tag.byEmail(email));
|
|
}
|
|
},
|
|
};
|