summaryrefslogtreecommitdiff
path: root/elm3/UVNList/Status.elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-07-29 16:48:48 +0200
committerYorhel <git@yorhel.nl>2019-07-29 16:53:04 +0200
commit6cda16f862283b4cb502af8ebdddea25bde29816 (patch)
tree4a143aade9cd01d9ee7880a4696fd7ed4bdbb959 /elm3/UVNList/Status.elm
parente1e1d4e9b85d4ff0b26832fe95374f6f9718511e (diff)
v3: Define & Generate API responses from Perl
This allows Perl modules to define new API responses and the corresponding Elm type and parser will be generated automatically. The primary reason to do this is to ensure that Elm and Perl stay synchronized and to make sure that errors in generating API responses can easily be found on the server side. Also moded json_api() from VN3::Validate to VN3::Prelude, as that seemed more fitting.
Diffstat (limited to 'elm3/UVNList/Status.elm')
-rw-r--r--elm3/UVNList/Status.elm8
1 files changed, 4 insertions, 4 deletions
diff --git a/elm3/UVNList/Status.elm b/elm3/UVNList/Status.elm
index e11443df..7a2782d2 100644
--- a/elm3/UVNList/Status.elm
+++ b/elm3/UVNList/Status.elm
@@ -8,7 +8,7 @@ import Browser
import Lib.Api as Api
import Lib.Html exposing (..)
import Lib.Util exposing (lookup)
-import Lib.Gen exposing (vnlistStatus)
+import Lib.Gen as Gen
main : Program Flags Model Msg
@@ -59,7 +59,7 @@ update msg model =
in ( nmodel
, Api.post "/u/setvnstatus" (encodeForm nmodel) Saved )
- Saved Api.Success -> ({ model | state = Api.Normal }, Cmd.none)
+ Saved Gen.Success -> ({ model | state = Api.Normal }, Cmd.none)
Saved e -> ({ model | state = Api.Error e }, Cmd.none)
@@ -69,9 +69,9 @@ view model =
if model.state == Api.Loading
then div [ class "spinner spinner--md" ] []
else div []
- [ text <| Maybe.withDefault "" <| lookup model.flags.status vnlistStatus
+ [ text <| Maybe.withDefault "" <| lookup model.flags.status Gen.vnlistStatus
, inputSelect
[ class "form-control--table-edit form-control--table-edit-overlay", onInput Input ]
(String.fromInt model.flags.status)
- (List.map (\(a,b) -> (String.fromInt a, b)) vnlistStatus)
+ (List.map (\(a,b) -> (String.fromInt a, b)) Gen.vnlistStatus)
]