diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-11 23:11:02 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-11 23:11:02 +0900 |
| commit | e65ee1dd3403b1572bb64217912b4bc466f65957 (patch) | |
| tree | cf120caf0b1d27b4067b1e1133b787618906d8fc /frontend/app/components/GolfWatchApp.client.tsx | |
| parent | fe8b14ccc77c829a2baa4034edb22daff9d5d8f8 (diff) | |
| parent | 34d61fcc7035ebd7ffb636d13308166c90b474b2 (diff) | |
| download | iosdc-japan-2024-albatross-e65ee1dd3403b1572bb64217912b4bc466f65957.tar.gz iosdc-japan-2024-albatross-e65ee1dd3403b1572bb64217912b4bc466f65957.tar.zst iosdc-japan-2024-albatross-e65ee1dd3403b1572bb64217912b4bc466f65957.zip | |
Merge branch 'feat/simplify-starting-procedure'
Diffstat (limited to 'frontend/app/components/GolfWatchApp.client.tsx')
| -rw-r--r-- | frontend/app/components/GolfWatchApp.client.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx index a9c9989..cef6f9a 100644 --- a/frontend/app/components/GolfWatchApp.client.tsx +++ b/frontend/app/components/GolfWatchApp.client.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; -import useWebSocket, { ReadyState } from "react-use-websocket"; import type { components } from "../.server/api/schema"; +import useWebSocket, { ReadyState } from "../hooks/useWebSocket"; import GolfWatchAppConnecting from "./GolfWatchApps/GolfWatchAppConnecting"; import GolfWatchAppFinished from "./GolfWatchApps/GolfWatchAppFinished"; import GolfWatchAppGaming, { @@ -9,7 +9,8 @@ import GolfWatchAppGaming, { import GolfWatchAppStarting from "./GolfWatchApps/GolfWatchAppStarting"; import GolfWatchAppWaiting from "./GolfWatchApps/GolfWatchAppWaiting"; -type WebSocketMessage = components["schemas"]["GameWatcherMessageS2C"]; +type GameWatcherMessageS2C = components["schemas"]["GameWatcherMessageS2C"]; +type GameWatcherMessageC2S = never; type Game = components["schemas"]["Game"]; @@ -27,10 +28,10 @@ export default function GolfWatchApp({ ? `ws://localhost:8002/iosdc-japan/2024/code-battle/sock/golf/${game.game_id}/watch?token=${sockToken}` : `wss://t.nil.ninja/iosdc-japan/2024/code-battle/sock/golf/${game.game_id}/watch?token=${sockToken}`; - const { lastJsonMessage, readyState } = useWebSocket<WebSocketMessage>( - socketUrl, - {}, - ); + const { lastJsonMessage, readyState } = useWebSocket< + GameWatcherMessageS2C, + GameWatcherMessageC2S + >(socketUrl); const [gameState, setGameState] = useState<GameState>("connecting"); |
