repod/src/components/Sidebar/Subscriptions.vue

69 lines
1.5 KiB
Vue
Raw Normal View History

2023-07-04 15:43:58 +00:00
<template>
<AppNavigation>
<template #list>
<NcAppContentList>
<router-link to="/">
<NcAppNavigationNew :text="t('repod', 'Add a podcast')">
<template #icon>
2024-03-16 17:35:31 +00:00
<PlusIcon :size="20" />
</template>
</NcAppNavigationNew>
</router-link>
<Loading v-if="loading" />
<NcAppNavigationList v-if="!loading">
<Item v-for="subscriptionUrl of subscriptions"
:key="subscriptionUrl"
:url="subscriptionUrl" />
</NcAppNavigationList>
</NcAppContentList>
</template>
<template #footer>
2024-03-16 17:35:31 +00:00
<Settings />
</template>
</AppNavigation>
2023-07-04 15:43:58 +00:00
</template>
<script>
2024-03-16 17:35:31 +00:00
import { NcAppContentList, NcAppNavigationList, NcAppNavigationNew } from '@nextcloud/vue'
import AppNavigation from '../Atoms/AppNavigation.vue'
2023-08-28 19:18:14 +00:00
import Item from './Item.vue'
2023-12-23 21:49:23 +00:00
import Loading from '../Atoms/Loading.vue'
2024-03-16 17:35:31 +00:00
import PlusIcon from 'vue-material-design-icons/Plus.vue'
import Settings from '../Settings/Settings.vue'
2023-07-04 15:43:58 +00:00
import { showError } from '@nextcloud/dialogs'
export default {
2023-08-28 19:18:14 +00:00
name: 'Subscriptions',
2023-07-04 15:43:58 +00:00
components: {
AppNavigation,
2023-08-23 08:11:39 +00:00
Item,
2023-12-23 21:49:23 +00:00
Loading,
2023-07-04 15:43:58 +00:00
NcAppContentList,
NcAppNavigationList,
2023-07-04 15:43:58 +00:00
NcAppNavigationNew,
2024-03-16 17:35:31 +00:00
PlusIcon,
Settings,
2023-07-04 15:43:58 +00:00
},
data() {
return {
loading: true,
}
},
2023-07-07 14:35:14 +00:00
computed: {
2023-07-07 16:38:53 +00:00
subscriptions() {
2023-07-09 22:25:32 +00:00
return this.$store.state.subscriptions.subscriptions
2023-07-07 14:35:14 +00:00
},
},
2023-07-04 15:43:58 +00:00
async mounted() {
try {
2023-07-08 22:07:21 +00:00
await this.$store.dispatch('subscriptions/fetch')
2023-07-04 15:43:58 +00:00
} catch (e) {
console.error(e)
2024-01-10 14:25:54 +00:00
showError(t('repod', 'Could not fetch subscriptions'))
2023-07-09 22:25:32 +00:00
} finally {
this.loading = false
2023-07-04 15:43:58 +00:00
}
},
}
</script>