fix(front): syntax and performance improvements in playlist detail
This commit is contained in:
parent
f8bfbb4434
commit
e1bc3d2474
|
@ -143,7 +143,7 @@ class PlaylistViewSet(
|
|||
|
||||
# Apply pagination
|
||||
paginator = PageNumberPagination()
|
||||
paginator.page_size = 100 # Set the page size (number of items per page)
|
||||
paginator.page_size = 50 # Set the page size (number of items per page)
|
||||
paginated_plts = paginator.paginate_queryset(plts, request)
|
||||
|
||||
# Serialize the paginated data
|
||||
|
|
|
@ -45,7 +45,7 @@ interface Props {
|
|||
paginateResults?: boolean
|
||||
total?: number
|
||||
page?: number
|
||||
paginateBy?: number,
|
||||
paginateBy?: number
|
||||
|
||||
unique?: boolean
|
||||
}
|
||||
|
|
|
@ -96,20 +96,19 @@ const loadMoreTracks = async () => {
|
|||
if (nextPage.value) {
|
||||
isLoadingMoreTracks.value = true; // Set loading state for the button
|
||||
try {
|
||||
const response = await axios.get(nextPage.value);
|
||||
const response = await axios.get(nextPage.value)
|
||||
|
||||
// Append new tracks to the existing list
|
||||
fullPlaylistTracks.value = [...fullPlaylistTracks.value, ...response.data.results];
|
||||
|
||||
fullPlaylistTracks.value = [...fullPlaylistTracks.value, ...response.data.results]
|
||||
// Update pagination metadata
|
||||
nextPage.value = response.data.next;
|
||||
nextPage.value = response.data.next
|
||||
} catch (error) {
|
||||
useErrorHandler(error as Error)
|
||||
} finally {
|
||||
isLoadingMoreTracks.value = false; // Reset loading state
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fetchData()
|
||||
|
||||
|
|
Loading…
Reference in New Issue