works on claims
This commit is contained in:
20
src/Api.elm
20
src/Api.elm
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user