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) {