Add lamassu-admin-elm to this repo (#185)

This commit is contained in:
Rafael Taranto 2018-10-08 16:29:06 -03:00 committed by Josh Harvey
parent 5ee7e40872
commit f4fc9d6328
134 changed files with 28171 additions and 83 deletions

View file

@ -0,0 +1,31 @@
module Transaction.Rest exposing (..)
import RemoteData exposing (..)
import HttpBuilder exposing (..)
import Http
import HttpBuilder exposing (..)
import BasicTypes exposing (..)
import Common.TransactionTypes exposing (..)
import Transaction.Types exposing (..)
import Transaction.Decoder exposing (txDecoder)
toModel : SavingStatus -> Tx -> SubModel
toModel status tx =
{ status = status, tx = tx }
getForm : String -> Cmd Msg
getForm txId =
get ("/api/transaction/" ++ txId)
|> withExpect (Http.expectJson txDecoder)
|> send (Result.map (toModel NotSaving) >> RemoteData.fromResult)
|> Cmd.map Load
cancel : String -> Cmd Msg
cancel txId =
patch ("/api/transaction/" ++ txId ++ "?cancel=true")
|> withExpect (Http.expectJson txDecoder)
|> send (Result.map (toModel NotSaving) >> RemoteData.fromResult)
|> Cmd.map Load