From 8588c41180676482a770576e32ea354e1adeccae Mon Sep 17 00:00:00 2001 From: Afeez Aziz Date: Sat, 6 Jul 2024 17:42:19 +0800 Subject: [PATCH] 321 --- src/App.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/App.js b/src/App.js index 10b27bd..7b908aa 100644 --- a/src/App.js +++ b/src/App.js @@ -1,13 +1,22 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useCallback } from 'react'; import Phaser from 'phaser'; import axios from 'axios'; import { TonConnectButton, useTonAddress, useTonConnectUI } from '@tonconnect/ui-react'; function App() { const [clickCount, setClickCount] = useState(0); - const [tonConnectUI] = useTonConnectUI(); + const [_tonConnectUI] = useTonConnectUI(); // Prefixed with underscore to indicate intentional non-use const userAddress = useTonAddress(); + const sendClickCountToAPI = useCallback(async () => { + try { + await axios.post('YOUR_API_ENDPOINT', { clickCount }); + console.log('Click count sent to API'); + } catch (error) { + console.error('Error sending click count to API:', error); + } + }, [clickCount]); + useEffect(() => { const config = { type: Phaser.AUTO, @@ -47,16 +56,7 @@ function App() { if (clickCount > 0 && clickCount % 10 === 0) { sendClickCountToAPI(); } - }, [clickCount]); - - const sendClickCountToAPI = async () => { - try { - await axios.post('https://webhook.site/bd11b5a9-a2b5-45a2-af5a-09b10cf85ced', { clickCount }); - console.log('Click count sent to API'); - } catch (error) { - console.error('Error sending click count to API:', error); - } - }; + }, [clickCount, sendClickCountToAPI]); return (