Browse Source

fix: consolidate all user routes

main
Inhji Y. 8 months ago
parent
commit
425d27c727
  1. 27
      lib/mirage_web/router.ex

27
lib/mirage_web/router.ex

@ -29,7 +29,6 @@ defmodule MirageWeb.Router do
live "/", HomeLive, :index
resources "/topics", TopicController
resources "/settings", SettingController, only: [:index, :show, :edit, :update]
live "/links", LinkLive.Index, :index
live "/links/new", LinkLive.Index, :new
@ -46,12 +45,6 @@ defmodule MirageWeb.Router do
live "/notes/:id/show/edit", NoteLive.Show, :edit
end
scope "/user", MirageWeb do
pipe_through [:browser, :require_authenticated_user]
get "/", UserController, :index
end
# Other scopes may use custom stacks.
# scope "/api", MirageWeb do
# pipe_through :api
@ -78,6 +71,18 @@ defmodule MirageWeb.Router do
## Authentication routes
scope "/", MirageWeb do
pipe_through [:browser, :require_authenticated_user]
get "/user", UserController, :index
resources "/user/settings", SettingController, only: [:index, :show, :edit, :update]
get "/user/edit", UserSettingsController, :edit
put "/user/edit", UserSettingsController, :update
get "/user/edit/confirm_email/:token", UserSettingsController, :confirm_email
end
scope "/", MirageWeb do
pipe_through [:browser, :redirect_if_user_is_authenticated]
@ -91,14 +96,6 @@ defmodule MirageWeb.Router do
put "/user/reset_password/:token", UserResetPasswordController, :update
end
scope "/", MirageWeb do
pipe_through [:browser, :require_authenticated_user]
get "/user/settings", UserSettingsController, :edit
put "/user/settings", UserSettingsController, :update
get "/user/settings/confirm_email/:token", UserSettingsController, :confirm_email
end
scope "/", MirageWeb do
pipe_through [:browser]

Loading…
Cancel
Save