Extract apply_fallback_index to shared helper

Closes #92
This commit is contained in:
Claudio Ortolina
2026-03-05 19:50:50 +00:00
parent d4376e5fa0
commit 6d72df3905
6 changed files with 19 additions and 56 deletions
@@ -46,4 +46,12 @@ defmodule MusicLibraryWeb.LiveHelpers.Params do
def merge_order(params, order) do
Map.put(params, :order, order)
end
def apply_fallback_index(socket, params, stream_key, apply_action_fn) do
if get_in(socket.assigns, [:streams, stream_key]) == nil do
apply_action_fn.(socket, :index, params)
else
socket
end
end
end