repod/src/views/Feed.vue
Michel Roux b7025a7aa1
All checks were successful
repod / xml (push) Successful in 17s
repod / php (push) Successful in 1m3s
repod / nodejs (push) Successful in 1m6s
repod / release (push) Has been skipped
fix: 💄 fix padding and routing
2024-08-27 16:41:58 +02:00

75 lines
1.5 KiB
Vue

<template>
<AppContent>
<Loading v-if="loading" />
<EmptyContent
v-if="failed"
class="error"
:name="t('repod', 'Error loading feed')">
<template #icon>
<Alert />
</template>
</EmptyContent>
<Banner
v-if="feed"
:author="feed.author"
:description="feed.description"
:image-url="feed.imageUrl"
:link="feed.link"
:title="feed.title" />
<Episodes v-if="feed" />
</AppContent>
</template>
<script>
import Alert from 'vue-material-design-icons/Alert.vue'
import AppContent from '../components/Atoms/AppContent.vue'
import Banner from '../components/Feed/Banner.vue'
import EmptyContent from '../components/Atoms/EmptyContent.vue'
import Episodes from '../components/Feed/Episodes.vue'
import Loading from '../components/Atoms/Loading.vue'
import axios from '@nextcloud/axios'
import { decodeUrl } from '../utils/url.js'
import { generateUrl } from '@nextcloud/router'
export default {
name: 'Feed',
components: {
Alert,
AppContent,
Banner,
EmptyContent,
Episodes,
Loading,
},
data: () => ({
failed: false,
loading: true,
feed: null,
}),
computed: {
url() {
return decodeUrl(this.$route.params.url)
},
},
async mounted() {
try {
const podcastData = await axios.get(
generateUrl('/apps/repod/podcast?url={url}', { url: this.url }),
)
this.feed = podcastData.data
} catch (e) {
this.failed = true
console.error(e)
} finally {
this.loading = false
}
},
}
</script>
<style scoped>
.error {
margin: 2rem;
}
</style>