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>
|
<template #subname>
|
||||||
{{ feed.author }}
|
{{ feed.author }}
|
||||||
</template>
|
</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>
|
</NcListItem>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { NcAvatar, NcListItem } from '@nextcloud/vue'
|
import { NcActionButton, NcAvatar, NcListItem } from '@nextcloud/vue'
|
||||||
import Loading from '../Atoms/Loading.vue'
|
import Loading from '../Atoms/Loading.vue'
|
||||||
|
import PlusIcon from 'vue-material-design-icons/Plus.vue'
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { debounce } from '../../utils/debounce.js'
|
import { debounce } from '../../utils/debounce.js'
|
||||||
import { formatLocaleDate } from '../../utils/time.js'
|
import { formatLocaleDate } from '../../utils/time.js'
|
||||||
@ -36,8 +46,10 @@ export default {
|
|||||||
name: 'Search',
|
name: 'Search',
|
||||||
components: {
|
components: {
|
||||||
Loading,
|
Loading,
|
||||||
|
NcActionButton,
|
||||||
NcAvatar,
|
NcAvatar,
|
||||||
NcListItem,
|
NcListItem,
|
||||||
|
PlusIcon,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
@ -59,6 +71,22 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
formatLocaleDate,
|
formatLocaleDate,
|
||||||
toUrl,
|
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() {
|
search: debounce(async function value() {
|
||||||
try {
|
try {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
Loading…
Reference in New Issue
Block a user