add assign_defaults/2 to liveviews

This commit is contained in:
shibao 2021-09-02 23:31:16 -04:00 committed by oliviasculley
parent 2db21c8b69
commit e9ababa7e1
8 changed files with 16 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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