diff --git a/src/Content.tsx b/src/Content.tsx index f5edf7869..0ef54f4e0 100644 --- a/src/Content.tsx +++ b/src/Content.tsx @@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useReducer, + useState, } from 'react'; import Loading from 'src/components/layout/Loading'; @@ -33,6 +34,7 @@ import getConfig from './services/config'; import { REF_FARM_BOOST_CONTRACT_ID } from './services/near'; import { useGlobalPopUp } from './state/popUp'; import { globalStateReducer, WalletContext } from './utils/wallets-integration'; +import { getUserIsBlocked } from './services/api'; export type Account = AccountView & { account_id: string; @@ -70,6 +72,18 @@ export function Content() { const [globalState, globalStatedispatch] = GlobalStateReducer; const { selector, accountId } = useWalletSelector(); + const [isBlocked, setIsBlocked] = useState(false); + const blockFeatureEnabled = true; + // const blockFeatureEnabled = false; + useEffect(() => { + if (blockFeatureEnabled) { + getUserIsBlocked().then((res) => { + if (res.blocked === true) { + setIsBlocked(true); + } + }); + } + }, []); const getAccount = useCallback(async (): Promise => { if (!accountId) { @@ -193,6 +207,22 @@ export function Content() { + {isBlocked && blockFeatureEnabled && ( +
+
+

+ You are prohibited from accessing app.ref.finance due to your + location or other infringement of the Terms of Services. +

+
+
+ )} ); } diff --git a/src/services/api.ts b/src/services/api.ts index 60e00ca96..531b34dda 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -239,3 +239,10 @@ export const getMemeFarmingAssetsList = async ( return []; }); }; + +export const getUserIsBlocked = async (): Promise => { + return await fetch('https://geo.deltarpc.com/api/is-blocked', { + method: 'GET', + headers: { 'Content-type': 'application/json; charset=UTF-8' }, + }).then((res) => res.json()); +};