mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-05-15 15:52:42 +00:00
16 lines
383 B
Elixir
16 lines
383 B
Elixir
defmodule LiveBeatsWeb.RedirectController do
|
|
use LiveBeatsWeb, :controller
|
|
|
|
import LiveBeatsWeb.UserAuth, only: [fetch_current_user: 2]
|
|
|
|
plug :fetch_current_user
|
|
|
|
def redirect_authenticated(conn, _) do
|
|
if conn.assigns.current_user do
|
|
LiveBeatsWeb.UserAuth.redirect_if_user_is_authenticated(conn, [])
|
|
else
|
|
redirect(conn, to: ~p"/signin")
|
|
end
|
|
end
|
|
end
|