Skip to content

Commit

Permalink
Merge pull request #1326 from tapexyz/err
Browse files Browse the repository at this point in the history
fix: availability
  • Loading branch information
sasicodes authored Feb 27, 2024
2 parents f56f548 + a6b281a commit 321c1e0
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 42 deletions.
11 changes: 7 additions & 4 deletions apps/web/src/components/Login/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { EVENTS, Tower } from '@tape.xyz/generic'
import {
useGenerateLensApiRelayAddressQuery,
useHandleToAddressLazyQuery,
useProfileLazyQuery
} from '@tape.xyz/lens'
import type { CustomErrorWithData } from '@tape.xyz/lens/custom-types'
Expand Down Expand Up @@ -115,7 +116,9 @@ const Signup: FC<Props> = ({ showLogin, onSuccess, setShowSignup }) => {
const delegatedExecutor = data?.generateLensAPIRelayAddress

const [checkAvailability, { loading: checkingAvailability }] =
useProfileLazyQuery()
useHandleToAddressLazyQuery({
fetchPolicy: 'no-cache'
})
const [checkIsProfileMinted] = useProfileLazyQuery({
notifyOnNetworkStatusChange: true,
pollInterval: 3000,
Expand All @@ -131,7 +134,7 @@ const Signup: FC<Props> = ({ showLogin, onSuccess, setShowSignup }) => {

const onError = (error: CustomErrorWithData) => {
setCreating(false)
toast.error(error.name ?? error?.message ?? ERROR_MESSAGE)
toast.error(error?.message ?? ERROR_MESSAGE)
}

const { writeContractAsync, data: txnHash } = useWriteContract({
Expand All @@ -145,14 +148,14 @@ const Signup: FC<Props> = ({ showLogin, onSuccess, setShowSignup }) => {
const { data } = await checkAvailability({
variables: {
request: {
forHandle: `${LENS_NAMESPACE_PREFIX}${handle}`
handle: `${LENS_NAMESPACE_PREFIX}${handle}`
}
}
})
Tower.track(EVENTS.AUTH.SIGNUP_HANDLE_SEARCH, {
handle: `${LENS_NAMESPACE_PREFIX}${handle}`
})
if (data?.profile) {
if (data?.handleToAddress) {
return setIsHandleAvailable(false)
}
setIsHandleAvailable(true)
Expand Down
3 changes: 3 additions & 0 deletions packages/lens/documents/queries/HandleToAddress.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
query HandleToAddress($request: HandleToAddressRequest!) {
handleToAddress(request: $request)
}
Loading

0 comments on commit 321c1e0

Please sign in to comment.