2023-07-07 14:35:14 +00:00
|
|
|
<template>
|
|
|
|
<ul>
|
2023-07-08 22:07:21 +00:00
|
|
|
<NcAppNavigationNewItem :loading="loading"
|
|
|
|
:title="t('Add a RSS link')"
|
|
|
|
@new-item="addSubscription">
|
2023-07-07 14:35:14 +00:00
|
|
|
<template #icon>
|
2023-07-07 16:38:53 +00:00
|
|
|
<Plus :size="20" />
|
2023-07-07 14:35:14 +00:00
|
|
|
</template>
|
|
|
|
</NcAppNavigationNewItem>
|
|
|
|
</ul>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { NcAppNavigationNewItem } from '@nextcloud/vue'
|
|
|
|
import Plus from 'vue-material-design-icons/Plus.vue'
|
2023-07-08 22:07:21 +00:00
|
|
|
import axios from '@nextcloud/axios'
|
|
|
|
import { generateUrl } from '@nextcloud/router'
|
|
|
|
import { showError } from '@nextcloud/dialogs'
|
2023-07-07 14:35:14 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'AddRss',
|
|
|
|
components: {
|
|
|
|
NcAppNavigationNewItem,
|
|
|
|
Plus,
|
|
|
|
},
|
2023-07-08 22:07:21 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
feedUrl: '',
|
|
|
|
}
|
|
|
|
},
|
2023-07-07 14:35:14 +00:00
|
|
|
methods: {
|
2023-07-08 22:07:21 +00:00
|
|
|
async addSubscription(feedUrl) {
|
|
|
|
this.loading = true
|
|
|
|
|
|
|
|
try {
|
|
|
|
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [feedUrl], remove: [] })
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
showError(t('Error while adding the feed'))
|
|
|
|
}
|
|
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
|
|
this.$store.dispatch('subscriptions/fetch')
|
|
|
|
},
|
2023-07-07 14:35:14 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|