From 93870e618e754e7cbb12a2c8872497ccf2ca7362 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Wed, 15 Nov 2023 13:24:33 -0600 Subject: [PATCH] Use proper type --- components/DesktopSidebar/UserIcon.tsx | 3 ++- pages/api/users/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/DesktopSidebar/UserIcon.tsx b/components/DesktopSidebar/UserIcon.tsx index 5363d653..7909cb58 100644 --- a/components/DesktopSidebar/UserIcon.tsx +++ b/components/DesktopSidebar/UserIcon.tsx @@ -8,9 +8,10 @@ import { UserIconContainer, } from '@/styles/components/Sidebar/userIcon.styles'; import { Media } from '@/lib/media'; +import { QueriedUserData } from 'bookem-shared/src/types/database'; export const UserIcon = () => { - const [userData, setUserData] = useState(null); + const [userData, setUserData] = useState(null); const [error, setError] = useState(); useEffect(() => { diff --git a/pages/api/users/index.ts b/pages/api/users/index.ts index 27f13e02..a675e80d 100644 --- a/pages/api/users/index.ts +++ b/pages/api/users/index.ts @@ -4,7 +4,7 @@ import dbConnect from '@/lib/dbConnect'; import { getSession } from 'next-auth/react'; import Users from 'bookem-shared/src/models/Users'; -import { UserData } from 'bookem-shared/src/types/database'; +import { QueriedUserData } from 'bookem-shared/src/types/database'; export default async function handler( req: NextApiRequest, @@ -27,7 +27,7 @@ export default async function handler( await dbConnect(); try { - const user = (await Users.findOne({ email: email })) as UserData; + const user = (await Users.findOne({ email: email })) as QueriedUserData; res.status(200).json(user); } catch (e) { console.error('An error has occurred in index.ts', e);