{"version":3,"file":"BuyCounter.bd55d2b8.js","sources":["../../../app/frontend/src/components/nav/BuyCounter.tsx"],"sourcesContent":["import { useState, useEffect } from 'react'\nimport axios, { AxiosResponse, AxiosError } from 'axios'\n\nimport { useTranslation } from 'react-i18next'\n\nimport { useRecoilValue } from 'recoil'\nimport { walletState } from '../../atoms/WalletAtom'\nimport { ZERO_ADDRESS } from '../../constants'\n\nconst BuyCounter = () => {\n const { t } = useTranslation()\n\n const walletAddress = useRecoilValue(walletState)\n\n const [buyCount, setBuyCount] = useState(0)\n\n useEffect(() => {\n if (walletAddress === '' || walletAddress === ZERO_ADDRESS)\n return setBuyCount(0)\n CheckBuyCount()\n }, [walletAddress])\n\n const CheckBuyCount = () => {\n axios({\n method: 'GET',\n url: `${import.meta.env.VITE_API_BASE_URI}/api/v1/users/buy_count`,\n params: {\n address: walletAddress,\n },\n })\n .then((response: AxiosResponse) => {\n setBuyCount(response.data.buy_count)\n })\n .catch((error: AxiosError) => {\n console.error('error', error)\n })\n }\n\n let notes = <>>\n if (buyCount >= 0 && buyCount < 10) {\n notes = (\n <>\n
\nηΉε Έγη’Ίθͺγγ
\n