fix country modal show
This commit is contained in:
parent
7de1ce9611
commit
a662126cd0
|
@ -231,12 +231,11 @@ const RestrictedCountryCheck = () => {
|
|||
NON_RESTRICTED_JURISDICTION_KEY,
|
||||
false,
|
||||
)
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!confirmedCountry && !ipCountry && !loadingIpCountry) {
|
||||
setShowModal(true)
|
||||
}
|
||||
console.log(loadingIpCountry)
|
||||
|
||||
const showModal = useMemo(() => {
|
||||
return !confirmedCountry && !ipCountry && !loadingIpCountry
|
||||
}, [confirmedCountry, ipCountry, loadingIpCountry])
|
||||
|
||||
return showModal ? (
|
||||
|
|
|
@ -66,17 +66,16 @@ export default function useIpAddress() {
|
|||
const [showWarning, setShowWarning] = useState(false)
|
||||
const [ipCountry, setIpCountry] = useState('')
|
||||
|
||||
const {
|
||||
data: ipCountryCode,
|
||||
isInitialLoading,
|
||||
isFetching,
|
||||
isLoading,
|
||||
} = useQuery<string, Error>(['ip-address'], () => fetchIpGeolocation(), {
|
||||
const { data: ipCountryCode, isInitialLoading } = useQuery<string, Error>(
|
||||
['ip-address'],
|
||||
() => fetchIpGeolocation(),
|
||||
{
|
||||
cacheTime: 1000 * 60 * 2,
|
||||
staleTime: 1000 * 60 * 2,
|
||||
retry: 3,
|
||||
refetchOnWindowFocus: true,
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (ipCountryCode) {
|
||||
|
@ -90,8 +89,6 @@ export default function useIpAddress() {
|
|||
}
|
||||
}, [ipCountryCode])
|
||||
|
||||
const loadingIpCountry = isInitialLoading || isFetching || isLoading
|
||||
|
||||
if (CLUSTER === 'mainnet-beta' && !process.env.NEXT_PUBLIC_DISABLE_GEOBLOCK) {
|
||||
return {
|
||||
ipAllowed,
|
||||
|
@ -101,7 +98,7 @@ export default function useIpAddress() {
|
|||
borrowLendAllowed,
|
||||
showWarning,
|
||||
ipCountry,
|
||||
loadingIpCountry,
|
||||
loadingIpCountry: isInitialLoading,
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
|
@ -112,7 +109,7 @@ export default function useIpAddress() {
|
|||
borrowLendAllowed: true,
|
||||
showWarning: true,
|
||||
ipCountry,
|
||||
loadingIpCountry,
|
||||
loadingIpCountry: isInitialLoading,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue