mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-24 15:12:01 +03:00
27 lines
696 B
Elm
27 lines
696 B
Elm
module PagesHttp exposing (..)
|
|
|
|
import Http as H exposing (Response(..))
|
|
import Pages.Http exposing (..)
|
|
import SimulatedEffect.Http as Http
|
|
|
|
|
|
expectString : (Result Pages.Http.Error String -> msg) -> Http.Expect msg
|
|
expectString toMsg =
|
|
Http.expectStringResponse toMsg <|
|
|
\response ->
|
|
case response of
|
|
BadUrl_ url ->
|
|
Err (BadUrl url)
|
|
|
|
Timeout_ ->
|
|
Err Timeout
|
|
|
|
NetworkError_ ->
|
|
Err NetworkError
|
|
|
|
BadStatus_ metadata body ->
|
|
Err (BadStatus metadata body)
|
|
|
|
GoodStatus_ metadata body ->
|
|
Ok body
|