[offers][fix] Fix minor issues

pull/471/head
Ai Ling 3 years ago
parent 8b22b88fa2
commit 203043da3e

@ -1,5 +1,6 @@
import Error from 'next/error'; import Error from 'next/error';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useSession } from 'next-auth/react';
import { useState } from 'react'; import { useState } from 'react';
import { Spinner, useToast } from '@tih/ui'; import { Spinner, useToast } from '@tih/ui';
@ -34,11 +35,16 @@ export default function OfferProfile() {
ProfileDetailTab.OFFERS, ProfileDetailTab.OFFERS,
); );
const [analysis, setAnalysis] = useState<ProfileAnalysis>(); const [analysis, setAnalysis] = useState<ProfileAnalysis>();
const { data: session } = useSession();
const getProfileQuery = trpc.useQuery( const getProfileQuery = trpc.useQuery(
[ [
'offers.profile.listOne', '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', enabled: typeof offerProfileId === 'string',

@ -47,7 +47,7 @@ export const offersUserProfileRouter = createProtectedRouter()
}); });
}, },
}) })
.mutation('getUserProfiles', { .query('getUserProfiles', {
async resolve({ ctx }) { async resolve({ ctx }) {
const userId = ctx.session.user.id; const userId = ctx.session.user.id;
const result = await ctx.prisma.user.findFirst({ const result = await ctx.prisma.user.findFirst({

Loading…
Cancel
Save