Fix force adding already existing track to the playlist (#1802)

This commit is contained in:
wvffle 2022-07-17 11:14:54 +00:00 committed by Georg Krause
parent a545333ff7
commit 1c770ff5c2
2 changed files with 17 additions and 14 deletions

View File

@ -94,6 +94,8 @@ const submit = async () => {
isLoading.value = false
}
</script>
<template>

View File

@ -64,9 +64,7 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
if (error as BackendError) {
const { backendErrors, rawPayload = {} } = error as BackendError
// TODO (wvffle): Test if it works
// if (backendErrors.length === 1 && backendErrors[0].code === 'tracks_already_exist_in_playlist') {
if (backendErrors.length === 1 && backendErrors[0] === 'Tracks already exist in playlist') {
if (backendErrors.length === 1 && backendErrors[0] === 'Tracks Already Exist In Playlist') {
duplicateTrackAddInfo.value = ((rawPayload.playlist as APIErrorResponse).non_field_errors as APIErrorResponse)[0] as object
showDuplicateTrackAddConfirmation.value = true
} else {
@ -76,6 +74,8 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
}
}
}
store.dispatch('playlists/fetchOwn')
</script>
<template>
@ -249,8 +249,10 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
</div>
</template>
</div>
<template v-else>
<div class="ui placeholder segment">
<div
v-else
class="ui placeholder segment"
>
<div class="ui icon header">
<i class="list icon" />
<translate translate-context="Content/Home/Placeholder">
@ -258,7 +260,6 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
</translate>
</div>
</div>
</template>
</div>
<div class="actions">
<button class="ui basic cancel button">