make clothes tracking only work when logged in

This commit is contained in:
2021-09-15 15:22:51 +02:00
parent 68eb1c62ad
commit cbb7ad3ce8
2 changed files with 5 additions and 3 deletions
@@ -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