diff --git a/front/src/components/album/Widget.vue b/front/src/components/album/Widget.vue index 748c3c107..afd9c5531 100644 --- a/front/src/components/album/Widget.vue +++ b/front/src/components/album/Widget.vue @@ -3,8 +3,6 @@ import type { Album } from '~/types' import { reactive, ref, watch } from 'vue' import { useStore } from '~/store' -import { useI18n } from 'vue-i18n' - import axios from 'axios' @@ -17,8 +15,6 @@ import Loader from '~/components/ui/Loader.vue' import Pagination from '~/components/ui/Pagination.vue' -const { t } = useI18n() - interface Props { filters: Record showCount?: boolean @@ -56,7 +52,7 @@ const fetchData = async (url = 'albums/') => { const response = await axios.get(url, { params }) nextPage.value = response.data.next count.value = response.data.count - albums.push(...response.data.results) + albums.splice(0, albums.length, ...response.data.results) } catch (error) { useErrorHandler(error as Error) } diff --git a/front/src/components/audio/ChannelsWidget.vue b/front/src/components/audio/ChannelsWidget.vue index 7277f9e07..e7c709266 100644 --- a/front/src/components/audio/ChannelsWidget.vue +++ b/front/src/components/audio/ChannelsWidget.vue @@ -59,7 +59,7 @@ const fetchData = async (url = 'channels/') => { } onMounted(() => { - setTimeout(fetchData, 1000) + fetchData() }) watch([() => props.filters, page], @@ -71,16 +71,17 @@ watch([() => props.filters, page], diff --git a/front/src/components/library/Home.vue b/front/src/components/library/Home.vue index ccbee4b0a..7cd61a181 100644 --- a/front/src/components/library/Home.vue +++ b/front/src/components/library/Home.vue @@ -70,12 +70,10 @@ fetchData() - - - + :title="t('components.library.Home.header.playlists')" + :limit="12" + /> + - + - + - - - - + + diff --git a/front/src/components/playlists/Widget.vue b/front/src/components/playlists/Widget.vue index fc42a0251..c10f39fba 100644 --- a/front/src/components/playlists/Widget.vue +++ b/front/src/components/playlists/Widget.vue @@ -51,7 +51,7 @@ const fetchData = async (url = props.url) => { const response = await axios.get(url, { params }) nextPage.value = response.data.next count.value = response.data.count - objects.push(...response.data.results) + objects.splice(0, objects.length, ...response.data.results) } catch (error) { useErrorHandler(error as Error) } @@ -59,7 +59,7 @@ const fetchData = async (url = props.url) => { isLoading.value = false } -setTimeout(fetchData, 1000) +fetchData() watch( [() => store.state.moderation.lastUpdate, page], @@ -71,9 +71,10 @@ watch(