mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 20:37:59 +01:00
24 lines
551 B
Elixir
24 lines
551 B
Elixir
|
defmodule PhilomenaWeb.Autocomplete.CompiledController do
|
||
|
use PhilomenaWeb, :controller
|
||
|
|
||
|
alias Philomena.Autocomplete
|
||
|
|
||
|
def show(conn, _params) do
|
||
|
autocomplete = Autocomplete.get_autocomplete()
|
||
|
|
||
|
case autocomplete do
|
||
|
nil ->
|
||
|
conn
|
||
|
|> put_status(:not_found)
|
||
|
|> configure_session(drop: true)
|
||
|
|> text("")
|
||
|
|
||
|
%{content: content} ->
|
||
|
conn
|
||
|
|> put_resp_header("cache-control", "public, max-age=86400")
|
||
|
|> configure_session(drop: true)
|
||
|
|> resp(200, content)
|
||
|
end
|
||
|
end
|
||
|
end
|