forked from shibao/cannery
add assign_defaults/2 to liveviews
This commit is contained in:
parent
2db21c8b69
commit
e9ababa7e1
@ -5,8 +5,8 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
||||
alias Cannery.Ammo.AmmoGroup
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket |> assign(:ammo_groups, list_ammo_groups())}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session) |> assign(:ammo_groups, list_ammo_groups())}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
|
||||
alias Cannery.Ammo
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -5,8 +5,8 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|
||||
alias Cannery.Ammo.AmmoType
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket |> assign(:ammo_types, list_ammo_types())}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session) |> assign(:ammo_types, list_ammo_types())}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
|
||||
alias Cannery.Ammo
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -5,8 +5,8 @@ defmodule CanneryWeb.ContainerLive.Index do
|
||||
alias Cannery.Containers.Container
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket |> assign(:containers, list_containers())}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session) |> assign(:containers, list_containers())}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.ContainerLive.Show do
|
||||
alias Cannery.Containers
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -5,8 +5,8 @@ defmodule CanneryWeb.TagLive.Index do
|
||||
alias Cannery.Tags.Tag
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket |> assign(:tags, list_tags())}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session) |> assign(:tags, list_tags())}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.TagLive.Show do
|
||||
alias Cannery.Tags
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
def mount(_params, session, socket) do
|
||||
{:ok, socket |> assign_defaults(session)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
Loading…
Reference in New Issue
Block a user