From 7e646e1676e08331598ae2b9518f2b1b5f999ba2 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 3 Aug 2020 17:26:45 +0200 Subject: Make it deployable --- client/src/Client.elm | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'client/src') diff --git a/client/src/Client.elm b/client/src/Client.elm index 7cac663..6b65091 100644 --- a/client/src/Client.elm +++ b/client/src/Client.elm @@ -42,15 +42,8 @@ type alias GameState = type Model = Error String | Connecting - { roomId : String - } | Game GameState -parseRoomId : Url -> Result String String -parseRoomId url = case String.split "/" url.path of - _ :: "rooms" :: roomId :: _ -> Ok roomId - _ -> Err <| "Invalid path: " ++ url.path - viewPlayer : Messages.PlayerView -> Html msg viewPlayer player = Html.div [] <| [ Html.text player.name @@ -64,10 +57,7 @@ view model = case model of [ Html.h1 [] [Html.text "Error"] , Html.p [] [Html.text str] ] - Connecting state -> - [ Html.h1 [] - [Html.text <| "Connecting to room " ++ state.roomId ++ "..."] - ] + Connecting -> [Html.h1 [] [Html.text "Connecting to room..."]] Game game -> [ Html.h1 [] [Html.text "Players"] , Html.ul [] <| List.map @@ -305,9 +295,7 @@ update msg model = case msg of main : Program () Model Msg main = Browser.application - { init = \() url key -> case parseRoomId url of - Err str -> (Error <| "Could not parse room ID: " ++ str, Cmd.none) - Ok roomId -> (Connecting {roomId = roomId}, Cmd.none) + { init = \() url key -> (Connecting, Cmd.none) , update = update , subscriptions = subscriptions , view = \model -> {title = "Client", body = view model} -- cgit v1.2.3