From 9c9f625c539248f99671a1127cb3ec353fd7fd6d Mon Sep 17 00:00:00 2001 From: Stuart Long Chay Boon Date: Fri, 14 Oct 2022 02:14:29 +0800 Subject: [PATCH] [offers][feat] add add to user profile endpoint --- .../src/pages/offers/test/createProfile.tsx | 20 ++++++++++ .../router/offers/offers-profile-router.ts | 38 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/apps/portal/src/pages/offers/test/createProfile.tsx b/apps/portal/src/pages/offers/test/createProfile.tsx index 5b42a76f..67897015 100644 --- a/apps/portal/src/pages/offers/test/createProfile.tsx +++ b/apps/portal/src/pages/offers/test/createProfile.tsx @@ -25,6 +25,23 @@ function Test() { }, }); + const addToUserProfileMutation = trpc.useMutation(['offers.profile.addToUserProfile'], { + onError(err: any) { + alert(err); + }, + onSuccess(data) { + setCreatedData(JSON.stringify(data)); + }, + }) + + const handleLink = () => { + addToUserProfileMutation.mutate({ + profileId: 'cl96stky5002ew32gx2kale2x', + token: 'afca11e436d21bde24543718fa957c6c625335439dc504f24ee35eae7b5ef1ba', + userId: 'cl97dl51k001e7iygd5v5gt58' + }) + } + const handleClick = () => { createMutation.mutate({ background: { @@ -525,6 +542,9 @@ function Test() { +