repod/src/views/Feed.vue

71 lines
1.5 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" />
<NcEmptyContent v-if="failed" :title="t('Error loading feed')">
<template #icon>
<Alert />
</template>
</NcEmptyContent>
<div v-if="feed" class="header">
<NcAvatar :display-name="feed.author"
:is-no-user="true"
:url="feed.imageUrl" />
<div class="infos">
<h1>{{ feed.title }}</h1>
<a :href="feed.link" target="_blank">
{{ feed.author }}
</a>
<i>{{ feed.description }}</i>
</div>
<NcAppNavigationNew :text="t('Subscribe')">
<template #icon>
<Plus :size="20" />
</template>
</NcAppNavigationNew>
</div>
</fragment>
2023-07-29 15:53:51 +00:00
</template>
<script>
2023-08-02 09:33:48 +00:00
import { NcAppNavigationNew, NcAvatar, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'
import Alert from 'vue-material-design-icons/Alert.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
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,
NcAvatar,
NcAppNavigationNew,
NcEmptyContent,
NcLoadingIcon,
Plus,
},
data() {
return {
failed: false,
loading: true,
feed: null,
}
},
computed: {
url() {
return atob(this.$route.params.url)
},
},
async mounted() {
try {
const podcastData = await axios.get(generateUrl('/apps/gpoddersync/personal_settings/podcast_data?url={url}', { url: this.url }))
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>