Update root Main.elm to 0.19

This commit is contained in:
Richard Feldman
2018-03-03 17:24:16 -08:00
parent 81f46ee96f
commit c50d33d8d0

View File

@@ -5,18 +5,20 @@ have everything set up properly.
-} -}
import Auth import Auth
import Browser exposing (View)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Http import Http
import Json.Decode exposing (Decoder) import Json.Decode exposing (Decoder)
main : Program Never Model Msg main : Program () Model Msg
main = main =
Html.program Browser.fullscreen
{ view = view { view = view
, update = update , update = update
, init = ( initialModel, searchFeed ) , init = \env -> ( initialModel, searchFeed )
, onNavigation = Nothing
, subscriptions = \_ -> Sub.none , subscriptions = \_ -> Sub.none
} }
@@ -42,19 +44,21 @@ searchFeed =
|> Http.send Response |> Http.send Response
view : Model -> Html Msg view : Model -> View Msg
view model = view model =
div [ class "content" ] { body =
[ header [] [ h1 [] [ text "Elm Workshop" ] ] [ div [ class "content" ]
, div [ header [] [ h1 [] [ text "Elm Workshop" ] ]
[ style , div
[ ( "font-size", "48px" ) [ style "font-size" "48px"
, ( "text-align", "center" ) , style "text-align" "center"
, ( "padding", "48px" ) , style "padding" "48px"
] ]
[ text model.status ]
] ]
[ text model.status ]
] ]
, title = "Elm Workshop"
}
type Msg type Msg
@@ -80,18 +84,18 @@ update msg model =
Http.BadUrl url -> Http.BadUrl url ->
"Invalid test URL: " ++ url "Invalid test URL: " ++ url
Http.BadPayload msg _ -> Http.BadPayload error _ ->
"Something is misconfigured: " ++ msg "Something is misconfigured: " ++ error
Http.BadStatus { status } -> Http.BadStatus response ->
case status.code of case response.status.code of
401 -> 401 ->
"Auth.elm does not have a valid token. :( Try recreating Auth.elm by following the steps in the README under the section Create a GitHub Personal Access Token." "Auth.elm does not have a valid token. :( Try recreating Auth.elm by following the steps in the README under the section Create a GitHub Personal Access Token."
_ -> _ ->
"GitHub's Search API returned an error: " "GitHub's Search API returned an error: "
++ toString status.code ++ String.fromInt response.status.code
++ " " ++ " "
++ status.message ++ response.status.message
in in
( { status = status }, Cmd.none ) ( { status = status }, Cmd.none )