mirror of
https://git.crystalyx.net/Xefir/repod.git
synced 2024-12-25 00:14:32 +01:00
feat: ✨ ability to subscribe to podcast from search list (#105)
This commit is contained in:
parent
228fb82d5d
commit
f5a8e09d52
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user