make clothes tracking only work when logged in
This commit is contained in:
parent
68eb1c62ad
commit
cbb7ad3ce8
|
@ -13,8 +13,8 @@ defmodule PokemonCoutureWeb.ClothesTrackerLive do
|
|||
end
|
||||
end
|
||||
|
||||
def mount(_params, session, socket) do
|
||||
user = Accounts.get_user_by_session_token(session["user_token"])
|
||||
def mount(_params, %{"user_token" => user_token} = _session, socket) do
|
||||
user = Accounts.get_user_by_session_token(user_token)
|
||||
clothes_map = Enum.reduce(Shops.list_clothes_with_owners(), %{}, &create_shop_map/2)
|
||||
socket =
|
||||
socket
|
||||
|
|
|
@ -23,7 +23,7 @@ defmodule PokemonCoutureWeb.Router do
|
|||
|
||||
get "/", PageController, :index
|
||||
resources "/clothes", ClothesController
|
||||
live "/tracker", ClothesTrackerLive
|
||||
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
|
@ -65,6 +65,8 @@ defmodule PokemonCoutureWeb.Router do
|
|||
scope "/", PokemonCoutureWeb do
|
||||
pipe_through [:browser, :require_authenticated_user]
|
||||
|
||||
live "/tracker", ClothesTrackerLive
|
||||
|
||||
get "/users/settings", UserSettingsController, :edit
|
||||
put "/users/settings", UserSettingsController, :update
|
||||
get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email
|
||||
|
|
Loading…
Reference in New Issue