Fix force adding already existing track to the playlist (#1802)
This commit is contained in:
parent
a545333ff7
commit
1c770ff5c2
|
@ -94,6 +94,8 @@ const submit = async () => {
|
||||||
|
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -64,9 +64,7 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
|
||||||
if (error as BackendError) {
|
if (error as BackendError) {
|
||||||
const { backendErrors, rawPayload = {} } = error as BackendError
|
const { backendErrors, rawPayload = {} } = error as BackendError
|
||||||
|
|
||||||
// TODO (wvffle): Test if it works
|
if (backendErrors.length === 1 && backendErrors[0] === 'Tracks Already Exist In Playlist') {
|
||||||
// if (backendErrors.length === 1 && backendErrors[0].code === '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
|
duplicateTrackAddInfo.value = ((rawPayload.playlist as APIErrorResponse).non_field_errors as APIErrorResponse)[0] as object
|
||||||
showDuplicateTrackAddConfirmation.value = true
|
showDuplicateTrackAddConfirmation.value = true
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,6 +74,8 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store.dispatch('playlists/fetchOwn')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -249,8 +249,10 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<div
|
||||||
<div class="ui placeholder segment">
|
v-else
|
||||||
|
class="ui placeholder segment"
|
||||||
|
>
|
||||||
<div class="ui icon header">
|
<div class="ui icon header">
|
||||||
<i class="list icon" />
|
<i class="list icon" />
|
||||||
<translate translate-context="Content/Home/Placeholder">
|
<translate translate-context="Content/Home/Placeholder">
|
||||||
|
@ -258,7 +260,6 @@ const addToPlaylist = async (playlistId: number, allowDuplicates: boolean) => {
|
||||||
</translate>
|
</translate>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="ui basic cancel button">
|
<button class="ui basic cancel button">
|
||||||
|
|
Loading…
Reference in New Issue