Here’s a part of my liveview:
defmodule App1Web.SiteLive.Index do
use App1Web, :live_view
@impl true
def mount(_params, session, socket) do
user_id = session["current_user_id"]
# .......
# .......
{:ok, assign(socket, :my_items, my_items)}
end
How will I also access user_id
in this and analogous functions of the same module:
@impl true
def handle_event("delete", %{"id" => id}, socket) do
# .........
# how to access session["current_user_id"] ????
?
Or should I have saved user_id
somewhere in mount
?