aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils
diff options
context:
space:
mode:
authorJoris2016-06-12 23:54:17 +0200
committerJoris2016-06-12 23:54:17 +0200
commit6a0c5087f716ed6c876a666db6573491bfd3e094 (patch)
treebf439109143c7a1749c2661fc8b805b83a993027 /src/client/elm/Utils
parent38896af4281d2e191cbde15836a23e4c0274fff6 (diff)
Design income form
Diffstat (limited to 'src/client/elm/Utils')
-rw-r--r--src/client/elm/Utils/Date.elm39
-rw-r--r--src/client/elm/Utils/Http.elm14
2 files changed, 9 insertions, 44 deletions
diff --git a/src/client/elm/Utils/Date.elm b/src/client/elm/Utils/Date.elm
deleted file mode 100644
index 352e4ce..0000000
--- a/src/client/elm/Utils/Date.elm
+++ /dev/null
@@ -1,39 +0,0 @@
-module Utils.Date exposing
- ( monthToNum
- , numToMonth
- )
-
-import Date exposing (..)
-
-monthToNum : Month -> Int
-monthToNum month =
- case month of
- Jan -> 1
- Feb -> 2
- Mar -> 3
- Apr -> 4
- May -> 5
- Jun -> 6
- Jul -> 7
- Aug -> 8
- Sep -> 9
- Oct -> 10
- Nov -> 11
- Dec -> 12
-
-numToMonth : Int -> Month
-numToMonth n =
- case n of
- 1 -> Jan
- 2 -> Feb
- 3 -> Mar
- 4 -> Apr
- 5 -> May
- 6 -> Jun
- 7 -> Jul
- 8 -> Aug
- 9 -> Sep
- 10 -> Oct
- 11 -> Nov
- 12 -> Dec
- _ -> Jan
diff --git a/src/client/elm/Utils/Http.elm b/src/client/elm/Utils/Http.elm
index 97db053..9bcfad7 100644
--- a/src/client/elm/Utils/Http.elm
+++ b/src/client/elm/Utils/Http.elm
@@ -1,5 +1,6 @@
module Utils.Http exposing
( post
+ , postWithBody
, delete
, decodeHttpValue
, errorKey
@@ -10,17 +11,20 @@ import Task exposing (..)
import Json.Decode as Json exposing (Decoder)
post : String -> Task Error Value
-post = request "POST"
+post url = postWithBody url empty
+
+postWithBody : String -> Body -> Task Error Value
+postWithBody = request "POST"
delete : String -> Task Error Value
-delete = request "DELETE"
+delete url = request "DELETE" url empty
-request : String -> String -> Task Error Value
-request method url =
+request : String -> String -> Body -> Task Error Value
+request method url body =
{ verb = method
, headers = []
, url = url
- , body = empty
+ , body = body
}
|> Http.send defaultSettings
|> mapError promoteError