Ash FrameworkAF
Ash Framework3w ago
4 replies
ajst7les

dead view protected route

I can do this with my own plug but I wanted to know if there is any plugs built in to protect dead view routes my got to is the live session wrap but this is only for live views? e.g. something like this:
def call(conn, _opts) do
if conn.assigns[:current_user] do
conn
else
conn
|> put_flash(:error, "Please sign in to continue")
|> redirect(to: "/sign-in")
|> halt()
end
end
Was this page helpful?