commit 5e4261927c1b2f60356714b1b7fd3580ae74c09e
parent 17cd3aefecc95e86d4348ab9f171fa76e324a4b0
Author: Alberto Lerda <albertolerda97@gmail.com>
Date: Mon, 9 Jan 2023 13:27:43 +0100
fix style
Diffstat:
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/src/zenflows/restroom.ex b/src/zenflows/restroom.ex
@@ -88,23 +88,23 @@ and the data to post, it makes the request and parse the result.
"""
@spec request(fun(), String.t(), map()) :: {:ok, map()} | {:error, term()}
def request(request_fn, path, post_data) do
- hdrs = [{"content-type", "application/json"}]
+ hdrs = [{"content-type", "application/json"}]
- with {:ok, post_body} <- Jason.encode(%{data: post_data}),
- {:ok, %{status: stat, data: body}} when stat == 200 or stat == 500 <-
- request_fn.("POST", "/api/#{path}", hdrs, post_body),
- {:ok, data} <- Jason.decode(body) do
- if stat == 200 do
- {:ok, data}
- else
- {:error, data |> Map.fetch!("zenroom_errors") |> Map.fetch!("logs")}
- end
- else
- {:ok, %{status: stat, data: body}} ->
- {:error, "the http call result in non-200 status code #{stat}: #{inspect(body)}"}
+ with {:ok, post_body} <- Jason.encode(%{data: post_data}),
+ {:ok, %{status: stat, data: body}} when stat == 200 or stat == 500 <-
+ request_fn.("POST", "/api/#{path}", hdrs, post_body),
+ {:ok, data} <- Jason.decode(body) do
+ if stat == 200 do
+ {:ok, data}
+ else
+ {:error, data |> Map.fetch!("zenroom_errors") |> Map.fetch!("logs")}
+ end
+ else
+ {:ok, %{status: stat, data: body}} ->
+ {:error, "the http call result in non-200 status code #{stat}: #{inspect(body)}"}
- other -> other
- end
+ other -> other
+ end
end
# Return the salt from the configs.
diff --git a/src/zenflows/vf/person/resolv.ex b/src/zenflows/vf/person/resolv.ex
@@ -67,9 +67,7 @@ def delete_person(%{id: id}, _) do
end
def claim_person(%{id: id}, _) do
- with {:ok, did} <- Domain.claim(id) do
- {:ok, did}
- end
+ Domain.claim(id)
end
def images(per, _, _) do