Add lamassu-admin-elm to this repo (#185)
This commit is contained in:
parent
5ee7e40872
commit
f4fc9d6328
134 changed files with 28171 additions and 83 deletions
31
lamassu-admin-elm/src/Transaction/Rest.elm
Normal file
31
lamassu-admin-elm/src/Transaction/Rest.elm
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue