summaryrefslogtreecommitdiff
path: root/elm/User/Edit.elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-01-05 12:47:04 +0100
committerYorhel <git@yorhel.nl>2020-01-05 12:52:12 +0100
commitd1d981efa5b0910260cbd1c226e3ab683c8304ae (patch)
tree8704fd96dc8e5820dae8017e5bfaf882ed80980f /elm/User/Edit.elm
parent0efea750ac26629f48fb50a9cdc9d71bd08257b7 (diff)
refactor: Combine json_api() & elm_form() + generate Elm function to msg API endpoint
The new elm_api() function now creates an API endpoint (like json_api()) and generates a corresponding Elm module to interact with that API (like elm_form()). The API endpoint URL is now derived from the name of the Elm module, so there's no need to think of a separate URL and less prone to making typos when using that URL from Elm. Reduces the boilerplace a bit as well.
Diffstat (limited to 'elm/User/Edit.elm')
-rw-r--r--elm/User/Edit.elm2
1 files changed, 1 insertions, 1 deletions
diff --git a/elm/User/Edit.elm b/elm/User/Edit.elm
index 121e283a..ddd9f78e 100644
--- a/elm/User/Edit.elm
+++ b/elm/User/Edit.elm
@@ -122,7 +122,7 @@ update msg model =
Submit ->
if model.cpass && model.pass1 /= model.pass2
then ({ model | passNeq = True }, Cmd.none )
- else ({ model | state = Api.Loading }, Api.post "/u/edit.json" (GUE.encode model.data) Submitted)
+ else ({ model | state = Api.Loading }, GUE.send model.data Submitted)
-- TODO: This reload is only necessary for the skin and customcss options to apply, but it's nicer to do that directly from JS.
Submitted GApi.Success -> (model, load <| "/u" ++ String.fromInt model.data.id ++ "/edit")