conditionally load containers list
This commit is contained in:
parent
ee28de1178
commit
9cd2bc574b
@ -20,10 +20,13 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
|||||||
|
|
||||||
@spec update(Socket.t()) :: {:ok, Socket.t()}
|
@spec update(Socket.t()) :: {:ok, Socket.t()}
|
||||||
def update(%{assigns: %{ammo_group: ammo_group, current_user: current_user}} = socket) do
|
def update(%{assigns: %{ammo_group: ammo_group, current_user: current_user}} = socket) do
|
||||||
changeset = Ammo.change_ammo_group(ammo_group)
|
socket =
|
||||||
containers = Containers.list_containers(current_user)
|
socket
|
||||||
ammo_types = Ammo.list_ammo_types(current_user)
|
|> assign(:changeset, Ammo.change_ammo_group(ammo_group))
|
||||||
{:ok, socket |> assign(changeset: changeset, containers: containers, ammo_types: ammo_types)}
|
|> assign(:ammo_types, Ammo.list_ammo_types(current_user))
|
||||||
|
|> assign_new(:containers, fn -> Containers.list_containers(current_user) end)
|
||||||
|
|
||||||
|
{:ok, socket}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
Loading…
Reference in New Issue
Block a user