From 5e3f3ef6a25324899dd4f0309ac4ce94d20f8e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20T=C3=A4kker?= Date: Sat, 26 Sep 2026 00:21:59 +0200 Subject: [PATCH] Fix single track artist fields --- app/pages/admin/songs.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/pages/admin/songs.vue b/app/pages/admin/songs.vue index 86887f6..d91cd98 100644 --- a/app/pages/admin/songs.vue +++ b/app/pages/admin/songs.vue @@ -100,6 +100,12 @@ const serializeLyrics = (lyrics: Track["lyrics"] | undefined) => { return JSON.stringify(lyrics) } +const getArtistIds = (artists: Array = []) => + artists.map((artist) => (typeof artist === "string" ? artist : artist.value)) + +const getOptionId = (option: string | Option) => + typeof option === "string" ? option : option.value + const showModal = ref(false) const item = ref(undefined) @@ -145,8 +151,8 @@ const save = async (value: any) => { method: "POST", data: { name: `${value.name} - Single`, - artists: value.artists.map((artist: Option) => artist.value), - genres: value.genre.value, + artists: getArtistIds(value.artists), + genre: getOptionId(value.genre), file: value.cover, }, }) @@ -164,7 +170,7 @@ const save = async (value: any) => { data: { ...value, album: value.album?.value ?? value.album, - artists: value.artists.map((artist: Option) => artist.value), + artists: getArtistIds(value.artists), lyrics: serializeLyrics(value.lyrics), }, })