20 lines
524 B
Elixir
20 lines
524 B
Elixir
defmodule FacesWeb.FaceController do
|
|
use FacesWeb, :controller
|
|
alias Faces.Gallery
|
|
|
|
def index(conn, _params) do
|
|
render(conn, "index.html", people: Gallery.list_people())
|
|
end
|
|
|
|
def create(conn, %{"username" => username}) do
|
|
case Gallery.import_user(username) do
|
|
{:ok, _user} ->
|
|
render(conn, "index.html", people: Gallery.list_people())
|
|
|
|
{:error, reason} ->
|
|
conn
|
|
|> put_flash(:error, reason)
|
|
|> render("index.html", people: Gallery.list_people())
|
|
end
|
|
end
|
|
end
|