From 0de0c8256345a293db2d266dbf4dc5823eec3d0f Mon Sep 17 00:00:00 2001 From: Sergey Verevkin Date: Mon, 3 Apr 2023 14:21:52 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D1=81=D0=BC=D0=B5=D0=BD=D1=8B=20=D1=82?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/GamePage/GamePage.tsx | 11 +++++++++-- src/store/apiStore/apiStore.ts | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/GamePage/GamePage.tsx b/src/components/GamePage/GamePage.tsx index 8df4336..ff4fffb 100644 --- a/src/components/GamePage/GamePage.tsx +++ b/src/components/GamePage/GamePage.tsx @@ -21,6 +21,13 @@ type GameProps = { const GamePage: React.FC = (props) => { const {onExitGame} = props; const [state, setState] = useState(0); + const [url, setUrl] = useState(apiStore.apiUrl); + + const setNewUrl = (newUrl: string) => { + if (url === newUrl) return; + setUrl(newUrl); + apiStore.setApiUrl(newUrl); + }; const clickAtWitch = (guid: string) => { apiStore.turn(guid) @@ -78,8 +85,8 @@ const GamePage: React.FC = (props) => {
  • хостинг apiStore.setApiUrl(e.target.value)}/>
  • + value={url} + onChange={(e) => setNewUrl(e.target.value)}/>
  • прием CORS от ooya.ga
  • diff --git a/src/store/apiStore/apiStore.ts b/src/store/apiStore/apiStore.ts index 04eadb1..d8b1f14 100644 --- a/src/store/apiStore/apiStore.ts +++ b/src/store/apiStore/apiStore.ts @@ -108,7 +108,9 @@ class ApiStore { } setApiUrl(apiUrl: string) { - if (apiUrl !== this.apiUrl) this.apiUrl = apiUrl; + if (apiUrl !== this.apiUrl) { + this.apiUrl = apiUrl; + } } setVersion(version: string) {