added the ability for the users to hide there profile

This commit is contained in:
Daniel
2023-05-23 07:38:16 +03:30
parent e774f41d37
commit 240d92aeae
10 changed files with 94 additions and 34 deletions
+2 -9
View File
@@ -10,6 +10,7 @@ import useCollectionStore from "@/store/collections";
import { NewCollection } from "@/types/global";
import { useSession } from "next-auth/react";
import RequiredBadge from "../RequiredBadge";
import getPublicUserDataByEmail from "@/lib/client/getPublicUserDataByEmail";
type Props = {
toggleCollectionModal: Function;
@@ -36,14 +37,6 @@ export default function AddCollection({ toggleCollectionModal }: Props) {
if (response) toggleCollectionModal();
};
const getUserByEmail = async (email: string) => {
const response = await fetch(`/api/routes/users?email=${email}`);
const data = await response.json();
return data.response;
};
return (
<div className="flex flex-col gap-3 sm:w-[35rem] w-80">
<p className="text-xl text-sky-500 mb-2 text-center">New Collection</p>
@@ -107,7 +100,7 @@ export default function AddCollection({ toggleCollectionModal }: Props) {
memberEmail.trim() !== ownerEmail
) {
// Lookup, get data/err, list ...
const user = await getUserByEmail(memberEmail.trim());
const user = await getPublicUserDataByEmail(memberEmail.trim());
if (user.email) {
const newMember = {