front:migrate playlist.id to playlist.uuid that i forgot

This commit is contained in:
Petitminion 2025-04-27 19:18:57 +02:00
parent 324e63af40
commit cb014118a2
7 changed files with 15 additions and 13 deletions

View File

@ -12,7 +12,8 @@ import Spacer from '~/components/ui/Spacer.vue'
interface Props {
type: string
id: number
id?: number
uuid?: string
}
const { t } = useI18n()
@ -44,7 +45,8 @@ const iframeSrc = computed(() => {
? `&b=${instanceUrl}`
: ''
return `${base}embed.html?&type=${props.type}&id=${props.id}${bParam}`
const identifier = props.id ?? props.uuid
return `${base}embed.html?&type=${props.type}&id=${identifier}${bParam}`
})
const frameWidth = computed(() => width.value ?? '100%')

View File

@ -92,7 +92,7 @@ const responseHandlers = {
const fetchTracks = async () => {
// NOTE: This is handled by other functions and never used directly
const response = await axios.get(`playlists/${playlist.value?.id}/tracks/`)
const response = await axios.get(`playlists/${playlist.value?.uuid}/tracks/`)
playlistTracks.value = response.data.results
}
@ -101,7 +101,7 @@ const reorder = async ({ oldIndex: from, newIndex: to }: { oldIndex: number, new
isLoading.value = true
try {
await axios.post(`playlists/${playlist.value?.id}/move/`, { from, to })
await axios.post(`playlists/${playlist.value?.uuid}/move/`, { from, to })
await store.dispatch('playlists/fetchOwn')
responseHandlers.success()
} catch (error) {
@ -116,7 +116,7 @@ const removePlaylistTrack = async (index: number) => {
try {
tracks.value.splice(index, 1)
await axios.post(`playlists/${playlist.value?.id}/remove/`, { index })
await axios.post(`playlists/${playlist.value?.uuid}/remove/`, { index })
await Promise.all([
store.dispatch('playlists/fetchOwn'),
fetchTracks()
@ -134,7 +134,7 @@ const clearPlaylist = async () => {
try {
tracks.value = []
await axios.delete(`playlists/${playlist.value?.id}/clear/`)
await axios.delete(`playlists/${playlist.value?.uuid}/clear/`)
await store.dispatch('playlists/fetchOwn')
responseHandlers.success()
} catch (error) {
@ -148,7 +148,7 @@ const insertMany = async (insertedTracks: number[], allowDuplicates: boolean) =>
isLoading.value = true
try {
const response = await axios.post(`playlists/${playlist.value?.id}/add/`, {
const response = await axios.post(`playlists/${playlist.value?.uuid}/add/`, {
allow_duplicates: allowDuplicates,
tracks: insertedTracks
})

View File

@ -67,7 +67,7 @@ const submit = async () => {
errors.value = []
try {
const url = props.create ? 'playlists/' : `playlists/${playlist.value?.id}/`
const url = props.create ? 'playlists/' : `playlists/${playlist.value?.uuid}/`
const method = props.create ? 'post' : 'patch'
const data = {

View File

@ -69,7 +69,7 @@ const deletePlaylist = async () => {
try {
await axios.delete(`playlists/${props.playlist.uuid}/`)
store.dispatch('playlists/fetchOwn')
return router.push({ path: '/library' })
await router.push({ path: '/library' }) // <-- await instead of return
} catch (error) {
useErrorHandler(error as Error)
}
@ -161,7 +161,7 @@ const showDeleteModal = ref(false)
<div class="scrolling content">
<div class="description">
<embed-wizard
:id="playlist.uuid"
:uuid="playlist.uuid"
type="playlist"
/>
</div>

View File

@ -112,7 +112,7 @@ const getReportableObjects = ({ track, album, artist, artistCredit, playlist, ac
label: t('composables.moderation.useReport.playlist.label'),
target: {
type: 'playlist',
id: playlist.uuid,
uuid: playlist.uuid,
label: playlist.name,
_obj: playlist,
typeLabel: t('composables.moderation.useReport.playlist.typeLabel')

View File

@ -385,7 +385,7 @@ const radioConfig = computed<RadioConfig | null>(() =>
: count({ type: 'playlists' }) > 0
? ({
type: 'playlist',
ids: resultsPerCategory({ type: 'playlists' }).map(({ id }) => id.toString())
ids: resultsPerCategory({ type: 'playlists' }).map(({ uuid }) => uuid.toString())
})
: count({ type: 'artists' }) > 0
? ({

View File

@ -277,7 +277,7 @@ const shuffle = () => {}
<div class="scrolling content">
<div class="description">
<embed-wizard
:id="playlist.uuid"
:uuid="playlist.uuid"
type="playlist"
/>
</div>