Extract StaticAssets hook with a single default live_session
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
defmodule MusicLibraryWeb.Hooks.StaticAssets do
|
||||
use MusicLibraryWeb, :live_component
|
||||
|
||||
def on_mount(:default, _params, _session, socket) do
|
||||
socket =
|
||||
if static_changed?(socket) do
|
||||
put_flash(socket, :warning, gettext("The application has been updated, please reload."))
|
||||
else
|
||||
socket
|
||||
end
|
||||
|
||||
{:cont, socket}
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user