kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
fix(front): alert and no duplicate libraries in library widget
rodzic
0696298413
commit
d936e330d6
|
@ -11,6 +11,7 @@ import LibraryCard from '~/views/content/remote/Card.vue'
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
import Section from '~/components/ui/Section.vue'
|
import Section from '~/components/ui/Section.vue'
|
||||||
import Loader from '~/components/ui/Loader.vue'
|
import Loader from '~/components/ui/Loader.vue'
|
||||||
|
import Alert from '~/components/ui/Alert.vue'
|
||||||
|
|
||||||
import useErrorHandler from '~/composables/useErrorHandler'
|
import useErrorHandler from '~/composables/useErrorHandler'
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ const fetchData = async (url = props.url) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
nextPage.value = response.data.next
|
nextPage.value = response.data.next
|
||||||
libraries.push(...response.data.results)
|
libraries.splice(0, libraries.length, ...response.data.results)
|
||||||
emit('loaded', libraries)
|
emit('loaded', libraries)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
useErrorHandler(error as Error)
|
useErrorHandler(error as Error)
|
||||||
|
@ -68,20 +69,12 @@ watch(() => props.url, () => {
|
||||||
small-items
|
small-items
|
||||||
>
|
>
|
||||||
<Loader v-if="isLoading" style="grid-column: 1 / -1;" />
|
<Loader v-if="isLoading" style="grid-column: 1 / -1;" />
|
||||||
<p
|
<Alert blue
|
||||||
v-if="!isLoading && libraries.length > 0"
|
|
||||||
style="grid-column: 1 / -1;"
|
|
||||||
class="ui subtitle"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</p>
|
|
||||||
<p
|
|
||||||
v-if="!isLoading && libraries.length === 0"
|
v-if="!isLoading && libraries.length === 0"
|
||||||
style="grid-column: 1 / -1;"
|
style="grid-column: 1 / -1;"
|
||||||
class="ui subtitle"
|
|
||||||
>
|
>
|
||||||
{{ t('components.federation.LibraryWidget.empty.noMatch') }}
|
{{ t('components.federation.LibraryWidget.empty.noMatch') }}
|
||||||
</p>
|
</Alert>
|
||||||
<library-card
|
<library-card
|
||||||
v-for="library in libraries"
|
v-for="library in libraries"
|
||||||
:key="library.uuid"
|
:key="library.uuid"
|
||||||
|
|
Ładowanie…
Reference in New Issue