Fix FrontendController
This commit is contained in:
parent
d9a45175c0
commit
811dcc1928
2 changed files with 6 additions and 6 deletions
|
@ -94,10 +94,11 @@ def dir do
|
||||||
|> Path.join("frontends")
|
|> Path.join("frontends")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp download_or_unzip(%Frontend{file: nil} = frontend, dest),
|
defp download_or_unzip(%Frontend{build_url: build_url} = frontend, dest)
|
||||||
|
when is_binary(build_url),
|
||||||
do: download_build(frontend, dest)
|
do: download_build(frontend, dest)
|
||||||
|
|
||||||
defp download_or_unzip(%Frontend{file: file}, dest) do
|
defp download_or_unzip(%Frontend{file: file}, dest) when is_binary(file) do
|
||||||
with {:ok, zip} <- File.read(Path.expand(file)) do
|
with {:ok, zip} <- File.read(Path.expand(file)) do
|
||||||
unzip(zip, dest)
|
unzip(zip, dest)
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,9 +30,8 @@ def index(conn, _params) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def install(%{body_params: params} = conn, _params) do
|
def install(%{body_params: params} = conn, _params) do
|
||||||
frontend = params_to_frontend(params)
|
with %Frontend{} = frontend <- params_to_frontend(params),
|
||||||
|
%Frontend{} <- Frontend.install(frontend) do
|
||||||
with :ok <- Frontend.install(frontend) do
|
|
||||||
index(conn, %{})
|
index(conn, %{})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue