repod/src/views/Feed.vue

57 lines
1.1 KiB
Vue
Raw Normal View History

2023-07-29 15:53:51 +00:00
<template>
2023-08-02 09:33:48 +00:00
<fragment>
<NcLoadingIcon v-if="loading" />
2023-08-22 22:30:38 +00:00
<NcEmptyContent v-if="failed" :name="t('Error loading feed')">
2023-08-02 09:33:48 +00:00
<template #icon>
<Alert />
</template>
</NcEmptyContent>
2023-08-23 08:11:39 +00:00
<Banner v-if="feed"
:author="feed.author"
:image-url="feed.imageUrl"
:link="feed.link"
:title="feed.title" />
2023-08-02 09:33:48 +00:00
</fragment>
2023-07-29 15:53:51 +00:00
</template>
<script>
2023-08-23 08:11:39 +00:00
import { NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'
2023-08-02 09:33:48 +00:00
import Alert from 'vue-material-design-icons/Alert.vue'
2023-08-23 08:11:39 +00:00
import Banner from '../components/Feed/Banner.vue'
2023-08-02 09:33:48 +00:00
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
2023-07-29 15:53:51 +00:00
export default {
name: 'Feed',
2023-08-02 09:33:48 +00:00
components: {
Alert,
2023-08-23 08:11:39 +00:00
Banner,
2023-08-02 09:33:48 +00:00
NcEmptyContent,
NcLoadingIcon,
},
data() {
return {
failed: false,
loading: true,
feed: null,
}
},
computed: {
url() {
return atob(this.$route.params.url)
},
},
async mounted() {
try {
2023-08-22 18:14:15 +00:00
const podcastData = await axios.get(generateUrl('/apps/repod/fetch?url={url}', { url: this.url }))
2023-08-02 09:33:48 +00:00
this.feed = podcastData.data.data
} catch (e) {
this.failed = true
console.error(e)
} finally {
this.loading = false
}
},
2023-07-29 15:53:51 +00:00
}
</script>