[offers][feat] add isValidToken endpoint

pull/458/head
Stuart Long Chay Boon 2 years ago
parent 763e8f0332
commit a103879b5c

@ -205,6 +205,22 @@ function Test() {
},
);
trpc.useQuery(
[
`offers.profile.isValidToken`,
{
profileId: 'cl9scdzuh0000tt727ipone1k',
token:
'aa628d0db3ad7a5f84895537d4cca38edd0a9b8b96d869cddeb967fccf068c08',
},
],
{
onError(err) {
setError(err.shape?.message || '');
},
},
);
const replies = trpc.useQuery(
['offers.comments.getComments', { profileId }],
{

@ -102,6 +102,21 @@ const education = z.object({
});
export const offersProfileRouter = createRouter()
.query('isValidToken', {
input: z.object({
profileId: z.string(),
token: z.string(),
}),
async resolve({ ctx, input }) {
const profile = await ctx.prisma.offersProfile.findFirst({
where: {
id: input.profileId
}
})
return profile?.editToken === input.token
}
})
.query('listOne', {
input: z.object({
profileId: z.string(),

Loading…
Cancel
Save