From 0aa7df0b37e030cb714d92276c0bd49edb28aa37 Mon Sep 17 00:00:00 2001 From: shibao Date: Thu, 17 Nov 2022 22:32:37 -0500 Subject: [PATCH] always assign current_user to socket --- lib/memex_web/live/init_assigns.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/memex_web/live/init_assigns.ex b/lib/memex_web/live/init_assigns.ex index 910713a..7569d3f 100644 --- a/lib/memex_web/live/init_assigns.ex +++ b/lib/memex_web/live/init_assigns.ex @@ -15,5 +15,6 @@ defmodule MemexWeb.InitAssigns do {:cont, socket} end - def on_mount(:default, _params, _session, socket), do: {:cont, socket} + def on_mount(:default, _params, _session, socket), + do: {:cont, socket |> assign_new(:current_user, fn -> nil end)} end