diff --git a/apps/web/src/components/Profile/BasicInfo/Follow.tsx b/apps/web/src/components/Profile/BasicInfo/Follow.tsx index 46853ef25..e6bf98f1f 100644 --- a/apps/web/src/components/Profile/BasicInfo/Follow.tsx +++ b/apps/web/src/components/Profile/BasicInfo/Follow.tsx @@ -71,6 +71,15 @@ const Follow: FC = ({ profile, onSubscribe }) => { } }) + const write = ({ args }: { args: any[] }) => { + return writeContract({ + address: LENSHUB_PROXY_ADDRESS, + abi: LENSHUB_PROXY_ABI, + functionName: 'follow', + args + }) + } + const [broadcast] = useBroadcastOnchainMutation({ onCompleted: ({ broadcastOnchain }) => onCompleted(broadcastOnchain.__typename), @@ -101,21 +110,11 @@ const Follow: FC = ({ profile, onSubscribe }) => { variables: { request: { id, signature } } }) if (data?.broadcastOnchain?.__typename === 'RelayError') { - return writeContract({ - address: LENSHUB_PROXY_ADDRESS, - abi: LENSHUB_PROXY_ABI, - functionName: 'follow', - args - }) + return write({ args }) } return } - return writeContract({ - address: LENSHUB_PROXY_ADDRESS, - abi: LENSHUB_PROXY_ABI, - functionName: 'follow', - args - }) + return write({ args }) } catch { setLoading(false) } diff --git a/apps/web/src/components/Profile/BasicInfo/SuperFollow.tsx b/apps/web/src/components/Profile/BasicInfo/SuperFollow.tsx index 5ffea1cc9..01dd35989 100644 --- a/apps/web/src/components/Profile/BasicInfo/SuperFollow.tsx +++ b/apps/web/src/components/Profile/BasicInfo/SuperFollow.tsx @@ -86,6 +86,15 @@ const SuperFollow: FC = ({ profile, onJoin }) => { onError }) + const write = ({ args }: { args: any[] }) => { + return writeContract({ + address: LENSHUB_PROXY_ADDRESS, + abi: LENSHUB_PROXY_ABI, + functionName: 'follow', + args + }) + } + const { data: followModuleData } = useProfileFollowModuleQuery({ variables: { request: { forProfileId: profile?.id } }, skip: !profile?.id @@ -155,21 +164,11 @@ const SuperFollow: FC = ({ profile, onJoin }) => { variables: { request: { id, signature } } }) if (data?.broadcastOnchain.__typename === 'RelayError') { - return writeContract({ - address: LENSHUB_PROXY_ADDRESS, - abi: LENSHUB_PROXY_ABI, - functionName: 'follow', - args - }) + return write({ args }) } return } - return writeContract({ - address: LENSHUB_PROXY_ADDRESS, - abi: LENSHUB_PROXY_ABI, - functionName: 'follow', - args - }) + return write({ args }) } catch { setLoading(false) }