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 { interface Props {
type: string type: string
id: number id?: number
uuid?: string
} }
const { t } = useI18n() const { t } = useI18n()
@ -44,7 +45,8 @@ const iframeSrc = computed(() => {
? `&b=${instanceUrl}` ? `&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%') const frameWidth = computed(() => width.value ?? '100%')

View File

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

View File

@ -67,7 +67,7 @@ const submit = async () => {
errors.value = [] errors.value = []
try { 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 method = props.create ? 'post' : 'patch'
const data = { const data = {

View File

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

View File

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

View File

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

View File

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