diff --git a/lib/decentralised_book_index_web/router.ex b/lib/decentralised_book_index_web/router.ex index f8f379a..63035ac 100644 --- a/lib/decentralised_book_index_web/router.ex +++ b/lib/decentralised_book_index_web/router.ex @@ -35,27 +35,6 @@ defmodule DecentralisedBookIndexWeb.Router do scope "/", DecentralisedBookIndexWeb do pipe_through :browser - ash_authentication_live_session :maybe_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} do - # in each liveview, add one of the following at the top of the module: - # - # If an authenticated user must be present: - # on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_required} - # - # If an authenticated user *may* be present: - # on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} - # - # If an authenticated user must *not* be present: - # on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_no_user} - - live "/", BookLive.Index, :index - - live "/books", BookLive.Index, :index - live "/books/:id", BookLive.Show, :show - - live "/authors", AuthorLive.Index, :index - live "/authors/:id", AuthorLive.Show, :show - end - ash_authentication_live_session :moderator_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :moderator_required} do live "/books/new", BookLive.Edit, :new live "/books/:id/edit", BookLive.Edit, :edit @@ -79,6 +58,27 @@ defmodule DecentralisedBookIndexWeb.Router do live "/servers/:id", DbiServerLive.Show, :show live "/servers/:id/show/edit", DbiServerLive.Show, :edit end + + ash_authentication_live_session :maybe_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} do + # in each liveview, add one of the following at the top of the module: + # + # If an authenticated user must be present: + # on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_required} + # + # If an authenticated user *may* be present: + # on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} + # + # If an authenticated user must *not* be present: + # on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_no_user} + + live "/", BookLive.Index, :index + + live "/books", BookLive.Index, :index + live "/books/:id", BookLive.Show, :show + + live "/authors", AuthorLive.Index, :index + live "/authors/:id", AuthorLive.Show, :show + end end scope "/", DecentralisedBookIndexWeb do