mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 18:30:32 -06:00
27 lines
466 B
TypeScript
27 lines
466 B
TypeScript
import { revalidateTag } from "next/cache";
|
|
|
|
interface RevalidateProps {
|
|
id?: string;
|
|
email?: string;
|
|
}
|
|
|
|
export const userCache = {
|
|
tag: {
|
|
byId(id: string) {
|
|
return `users-${id}`;
|
|
},
|
|
byEmail(email: string) {
|
|
return `users-${email}`;
|
|
},
|
|
},
|
|
revalidate({ id, email }: RevalidateProps): void {
|
|
if (id) {
|
|
revalidateTag(this.tag.byId(id));
|
|
}
|
|
|
|
if (email) {
|
|
revalidateTag(this.tag.byEmail(email));
|
|
}
|
|
},
|
|
};
|