From 203043da3e927ed4dedf4c46c7c45014cbc5b009 Mon Sep 17 00:00:00 2001 From: Ai Ling Date: Mon, 31 Oct 2022 10:33:51 +0800 Subject: [PATCH] [offers][fix] Fix minor issues --- apps/portal/src/pages/offers/profile/[offerProfileId].tsx | 8 +++++++- .../server/router/offers/offers-user-profile-router.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/portal/src/pages/offers/profile/[offerProfileId].tsx b/apps/portal/src/pages/offers/profile/[offerProfileId].tsx index fdab7bd9..2b349e9c 100644 --- a/apps/portal/src/pages/offers/profile/[offerProfileId].tsx +++ b/apps/portal/src/pages/offers/profile/[offerProfileId].tsx @@ -1,5 +1,6 @@ import Error from 'next/error'; import { useRouter } from 'next/router'; +import { useSession } from 'next-auth/react'; import { useState } from 'react'; import { Spinner, useToast } from '@tih/ui'; @@ -34,11 +35,16 @@ export default function OfferProfile() { ProfileDetailTab.OFFERS, ); const [analysis, setAnalysis] = useState(); + const { data: session } = useSession(); const getProfileQuery = trpc.useQuery( [ 'offers.profile.listOne', - { profileId: offerProfileId as string, token: token as string }, + { + profileId: offerProfileId as string, + token: token as string, + userId: session?.user?.id, + }, ], { enabled: typeof offerProfileId === 'string', diff --git a/apps/portal/src/server/router/offers/offers-user-profile-router.ts b/apps/portal/src/server/router/offers/offers-user-profile-router.ts index d6837ddc..48994044 100644 --- a/apps/portal/src/server/router/offers/offers-user-profile-router.ts +++ b/apps/portal/src/server/router/offers/offers-user-profile-router.ts @@ -47,7 +47,7 @@ export const offersUserProfileRouter = createProtectedRouter() }); }, }) - .mutation('getUserProfiles', { + .query('getUserProfiles', { async resolve({ ctx }) { const userId = ctx.session.user.id; const result = await ctx.prisma.user.findFirst({