Redirect/2 do redirect without new action

Hello there! I encountered a problem with function redirect/3. I have in router.ex

    live "/users/register", UserRegistrationLive, :new
    live "/users/register", UserRegistrationLive, :ext

As you can see, I have the same router but with different actions on it. and I want to redirect action :ext with help of redirect/3:

conn
|> redirect(to: Routes.user_registration_path(conn, :ext))

And I have in my live controller handle_params for each of these actions:

def handle_params(_params, _uri, %{assigns: %{live_action: :new}} = socket) do
  {:noreply, socket
   |> assign(:stage, "user")
   |> IO.inspect()
  }
  end

  def handle_params(_params, _uri, %{assigns: %{live_action: :ext}} = socket) do
  {:noreply, socket
   |> assign(:stage, "profile")
  }

So the problem is that action :new goes well, but I cannot trigger second handle_params

Thank you in advance!

The router matches by the uri only, so it can only ever match live "/users/register", UserRegistrationLive, :new.

1 Like

Well. I`ve changed router with :ext to:

live "/users/register/ext", UserRegistrationLive, :ext

and it worked! Thanks!