Fix error when deleting a record from the artist page

This commit is contained in:
Claudio Ortolina
2025-06-11 17:29:04 +03:00
parent d3a14a8553
commit c23578725e
3 changed files with 20 additions and 0 deletions
@@ -185,6 +185,16 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
end
end
def handle_event("delete", %{"id" => id}, socket) do
record = Records.get_record!(id)
{:ok, _} = Records.delete_record(record)
{:noreply,
socket
|> assign_records(socket.assigns.artist.musicbrainz_id)
|> put_flash(:info, gettext("Record deleted"))}
end
defp apply_action(socket, :show, %{"musicbrainz_id" => musicbrainz_id}) do
artist = Artists.get_artist!(musicbrainz_id)
artist_info = Artists.get_artist_info!(musicbrainz_id)
+5
View File
@@ -880,3 +880,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "In progress - record will update automatically"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Record deleted"
msgstr ""
+5
View File
@@ -880,3 +880,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "In progress - record will update automatically"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Record deleted"
msgstr ""