live_beats/lib/live_beats_web/live/nav.ex

16 lines
385 B
Elixir
Raw Normal View History

2021-10-29 16:12:23 +00:00
defmodule LiveBeatsWeb.Nav do
import Phoenix.LiveView
2021-11-12 15:10:04 +00:00
alias LiveBeats.MediaLibrary
2021-11-19 19:50:36 +00:00
def on_mount(:default, params, _session, socket) do
active_tab =
case params do
%{"profile_username" => _profile} -> :index
_ -> :settings
end
{:cont, assign(socket, [active_users: MediaLibrary.list_active_profiles(limit: 20), active_tab: active_tab])}
2021-10-29 16:12:23 +00:00
end
end