feat: ability to subscribe to podcast from search list (#105)
All checks were successful
repod / xml (push) Successful in 22s
repod / php (push) Successful in 32s
repod / nodejs (push) Successful in 1m20s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-05-29 11:28:52 +00:00
parent 228fb82d5d
commit f5a8e09d52

View File

@ -17,14 +17,24 @@
<template #subname>
{{ feed.author }}
</template>
<template #actions>
<NcActionButton
v-if="!isSubscribed"
:name="t('repod', 'Subscribe')"
:title="t('repod', 'Subscribe')"
@click="addSubscription(feed.link)">
<PlusIcon :size="20" />
</NcActionButton>
</template>
</NcListItem>
</ul>
</div>
</template>
<script>
import { NcAvatar, NcListItem } from '@nextcloud/vue'
import { NcActionButton, NcAvatar, NcListItem } from '@nextcloud/vue'
import Loading from '../Atoms/Loading.vue'
import PlusIcon from 'vue-material-design-icons/Plus.vue'
import axios from '@nextcloud/axios'
import { debounce } from '../../utils/debounce.js'
import { formatLocaleDate } from '../../utils/time.js'
@ -36,8 +46,10 @@ export default {
name: 'Search',
components: {
Loading,
NcActionButton,
NcAvatar,
NcListItem,
PlusIcon,
},
props: {
value: {
@ -59,6 +71,22 @@ export default {
methods: {
formatLocaleDate,
toUrl,
async addSubscription(url) {
try {
await axios.post(
generateUrl('/apps/gpoddersync/subscription_change/create'),
{
add: [url],
remove: [],
},
)
} catch (e) {
console.error(e)
showError(t('repod', 'Error while adding the feed'))
}
this.$store.dispatch('subscriptions/fetch')
},
search: debounce(async function value() {
try {
this.loading = true