diff options
author | Yorhel <git@yorhel.nl> | 2019-12-08 10:41:09 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-12-08 10:41:12 +0100 |
commit | 113ca9f820f24b81486b5fb66045aa5ac1cb49c5 (patch) | |
tree | 3f3957372a2b6dace43996fdfcf3100bb239556e /elm/StaffEdit/Main.elm | |
parent | bf8739d1a5bc777eff864b6314a1e9bc3f464946 (diff) |
Fix json_api() URL matching + move URL parameters to POST body
For more consistency. Only exception right now is the password reset
form, which still has parameters in the URL. Didn't convert it as that
code doesn't use the elm_form() framework at the moment.
Diffstat (limited to 'elm/StaffEdit/Main.elm')
-rw-r--r-- | elm/StaffEdit/Main.elm | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/elm/StaffEdit/Main.elm b/elm/StaffEdit/Main.elm index d3e287da..4ea50fd5 100644 --- a/elm/StaffEdit/Main.elm +++ b/elm/StaffEdit/Main.elm @@ -57,7 +57,7 @@ init d = , l_twitter = d.l_twitter , l_anidb = d.l_anidb , l_pixiv = d.l_pixiv - , id = Just d.id + , id = d.id } @@ -82,7 +82,8 @@ new = encode : Model -> GSE.Send encode model = - { editsum = model.editsum.editsum.data + { id = model.id + , editsum = model.editsum.editsum.data , hidden = model.editsum.hidden , locked = model.editsum.locked , aid = model.aid @@ -147,13 +148,8 @@ update msg model = AliasAdd -> ({ model | alias = model.alias ++ [{ aid = newAid model, name = "", original = "", inuse = False }] }, Cmd.none) Submit -> - let - path = - case model.id of - Just id -> "/s" ++ String.fromInt id ++ "/edit" - Nothing -> "/s/add" - body = GSE.encode (encode model) - in ({ model | state = Api.Loading }, Api.post path body Submitted) + let body = GSE.encode (encode model) + in ({ model | state = Api.Loading }, Api.post "/s/edit.json" body Submitted) Submitted (GApi.Changed id rev) -> (model, load <| "/s" ++ String.fromInt id ++ "." ++ String.fromInt rev) Submitted r -> ({ model | state = Api.Error r }, Cmd.none) |