Allow clearing song lyrics

This commit is contained in:
lucast committed 2026-09-25 23:00:18 +02:00
1 parent a6e8bb51c5
commit 8ee6164218
2 files changed
+8 -3

No files matched your search

+7 -2
View File
@@ -67,6 +67,11 @@ const modalFields: Field[] = [
{ key: "lyrics.synced", label: "Synced lyrics", type: "checkbox" },
]
const serializeLyrics = (lyrics: Track["lyrics"] | undefined) => {
if (!lyrics?.text?.trim()) return JSON.stringify(null)
return JSON.stringify(lyrics)
}
const showModal = ref<boolean>(false)
const item = ref<Track | undefined>(undefined)
@@ -77,7 +82,7 @@ const save = async (value: any) => {
method: "PATCH",
data: {
...value,
lyrics: JSON.stringify(value.lyrics),
lyrics: serializeLyrics(value.lyrics),
},
params: { id: value._id },
forceFormData: true,
@@ -95,7 +100,7 @@ const save = async (value: any) => {
method: "POST",
data: {
...value,
lyrics: JSON.stringify(value.lyrics),
lyrics: serializeLyrics(value.lyrics),
},
})
+1 -1
View File
@@ -24,7 +24,7 @@ export interface Track extends Base {
lyrics: {
synced: boolean
text: string
}
} | null
album: Album
artists: Artist[]
durationInSeconds: number