The following code block in the Access Session Data in The Live View section is duplicated:
def mount(_params, session, socket) do
{
:ok,
assign(
socket,
score: 0,
message: "Guess a number.",
session_id: session["live_socket_id"]
)
}
end
The text also seems to suggest that the block should include an assignment to current_user
leveraging the Accounts.get_user_by_session_token/1
function, but that assignment is not present.
Therefore, the render/1
function that follows causes an error because @current_user.email
cannot be accessed.