index.community/backend/lib/backend_web/views/admin_login_view.ex

37 lines
727 B
Elixir
Raw Normal View History

2019-07-26 14:34:23 +00:00
defmodule BackendWeb.AdminLoginView do
use BackendWeb, :view
import Backend.Util
2019-08-23 13:08:05 +00:00
def render("show.json", %{error: error}) do
%{
error: error
}
end
2019-07-26 14:34:23 +00:00
2019-08-23 13:08:05 +00:00
def render("show.json", %{
instance_data: instance_data,
cleaned_domain: cleaned_domain
}) do
username = get_in(instance_data, ["contact_account", "username"])
2019-07-26 14:34:23 +00:00
fedi_account = get_account(username, cleaned_domain)
%{
domain: cleaned_domain,
email: Map.get(instance_data, "email"),
fediverseAccount: fedi_account
}
end
def render("create.json", %{error: error}) do
if error != nil do
%{
error: error
}
else
%{
data: "success"
}
end
end
end