Browse Source

добавлена возможность смены тестового URL

pull/1/head
Sergey Verevkin 3 years ago
parent
commit
0de0c82563
  1. 11
      src/components/GamePage/GamePage.tsx
  2. 4
      src/store/apiStore/apiStore.ts

11
src/components/GamePage/GamePage.tsx

@ -21,6 +21,13 @@ type GameProps = {
const GamePage: React.FC<GameProps> = (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<GameProps> = (props) => {
<li>хостинг
<input
type='text'
value={apiStore.apiUrl}
onChange={(e) => apiStore.setApiUrl(e.target.value)}/></li>
value={url}
onChange={(e) => setNewUrl(e.target.value)}/></li>
<li>прием CORS от ooya.ga</li>
</ul>
</div>

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

Loading…
Cancel
Save