Use LiveToast instead of built-in flash helpers

So that they can stack and get dismissed automatically
This commit is contained in:
Claudio Ortolina
2025-07-16 15:26:30 +01:00
parent 41f040363e
commit acd34424f7
18 changed files with 64 additions and 61 deletions
@@ -7,12 +7,12 @@ defmodule MusicLibraryWeb.LastFmController do
with {:ok, session} <- LastFm.get_session(token),
{:ok, _secret} <- Secrets.store("last_fm_session_key", session.key) do
conn
|> put_flash(:info, gettext("Successfully connected your Last.fm account"))
|> put_toast(:info, gettext("Successfully connected your Last.fm account"))
|> redirect(to: ~p"/")
else
{:error, reason} ->
conn
|> put_flash(:error, "Failed to connect your Last.fm account: #{reason}")
|> put_toast(:error, "Failed to connect your Last.fm account: #{reason}")
|> redirect(to: ~p"/")
end
end
@@ -22,7 +22,7 @@ defmodule MusicLibraryWeb.SessionController do
|> redirect(to: ~p"/")
else
conn
|> put_flash(:error, gettext("Invalid password"))
|> put_toast(:error, gettext("Invalid password"))
|> redirect(to: ~p"/login")
end
end