I am trying to redirect from one normal page back to the homepage using redirect
. However, if the Live page is marked with :live
in router.ex
it does not working.
The error is
no action DreamUpWeb.HomeLive for DreamUpWeb.Router.Helpers.live_path/3. The following actions/clauses are supported:
live_path(conn_or_endpoint, DreamUpWeb.BoardLive, params \\ [])
live_path(conn_or_endpoint, DreamUpWeb.LobbyLive, params \\ [])
live_path(conn_or_endpoint, DreamUpWeb.SetupLive, params \\ [])
router.ex:
live "/", HomeLive, :live
live "/lobby", LobbyLive
live "/board", BoardLive
live "/setup", SetupLive
redirect code in example_live.ex
{:noreply, redirect(socket, to: Routes.live_path(socket, DreamUpWeb.HomeLive, %{example: "example"}))}
If I remove :live
it works as normal and does not seem to impact anything. I’m seeking some help to understand what :live
actually accomplishes and why I cannot route to it using redirect
.