1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-19 10:37:01 +00:00

ui: Initial Elm UI import

Merged from https://github.com/jhillyerd/inbucket-elm

Uses https://github.com/halfzebra/create-elm-app
This commit is contained in:
James Hillyerd
2018-06-02 12:44:15 -07:00
parent 8b5a05eb40
commit c5b5321be3
24 changed files with 3027 additions and 1 deletions

39
ui/src/HttpUtil.elm Normal file
View File

@@ -0,0 +1,39 @@
module HttpUtil exposing (..)
import Http
delete : String -> Http.Request ()
delete url =
Http.request
{ method = "DELETE"
, headers = []
, url = url
, body = Http.emptyBody
, expect = Http.expectStringResponse (\_ -> Ok ())
, timeout = Nothing
, withCredentials = False
}
errorString : Http.Error -> String
errorString error =
case error of
Http.BadUrl str ->
"Bad URL: " ++ str
Http.Timeout ->
"HTTP timeout"
Http.NetworkError ->
"HTTP Network error"
Http.BadStatus res ->
"Bad HTTP status: " ++ toString res.status.code
Http.BadPayload msg res ->
"Bad HTTP payload: "
++ msg
++ " ("
++ toString res.status.code
++ ")"