This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
graphql-lightning-talk/lib/faces_web/controllers/face_controller.ex

21 lines
524 B
Elixir
Raw Normal View History

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