Files
formbricks-formbricks/packages/lib/user/cache.ts
Dhruwang Jariwala 663fa0124f chore: renamed profile to user (#1770)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-12-12 10:32:51 +00:00

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));
}
},
};