Got it. So this code here:
def mount(_params, %{"user_token" => user_token}, socket) do
user = user_token && Accounts.get_user_by_session_token(user_token)
...
end
Is actually a direct copy from UserAuth repurposed for the live view mount. If you want to create something that is more general purpose you might do this:
def get_current_user(%{"user_token" => user_token} = _session) do
user_token && Accounts.get_user_by_session_token(user_token)
end
Then you can do this in any of your mounts:
def mount(_params, session, socket) do
user = get_current_user(session)
end






















