works on claims

This commit is contained in:
2019-11-18 15:46:12 +01:00
parent ebdba97d1e
commit 44e44c70bf
2 changed files with 187 additions and 139 deletions

View File

@@ -14,7 +14,7 @@ module Api exposing
, blankPlayer
, checkList
, confirmAction
, fetchClaims
, fetchClaimsOf
, fetchLoot
, fetchPlayer
)
@@ -116,10 +116,20 @@ claimDecoder =
(D.field "loot_id" int)
fetchClaims : (Result Http.Error Claims -> msg) -> Int -> Cmd msg
fetchClaims toMsg playerId =
fetchClaimsOf : (Result Http.Error Claims -> msg) -> Int -> Cmd msg
fetchClaimsOf toMsg playerId =
let
url =
case playerId of
-- The 'group' need to see all claims
0 ->
"http://localhost:8088/api/claims"
id ->
"http://localhost:8088/api/players/" ++ String.fromInt playerId ++ "/claims"
in
Http.get
{ url = "http://localhost:8088/api/claims" -- TODO: ++ playerId
{ url = url
, expect =
valueDecoder (D.list claimDecoder)
|> Http.expectJson toMsg
@@ -197,7 +207,7 @@ fetchLoot toMsg dest =
"http://localhost:8088/api/players/" ++ String.fromInt id ++ "/loot"
OfShop ->
"http://localhost:8088/api/items"
"http://localhost:8088/api/shop"
OfGroup ->
"http://localhost:8088/api/players/0/loot"