repod/src/components/TopItem.vue

52 lines
878 B
Vue
Raw Normal View History

2023-07-25 20:07:35 +00:00
<template>
<a @click="addSubscription">
2023-07-29 15:53:51 +00:00
<img :alt="author"
:src="imgUrl"
:title="author">
2023-07-25 20:07:35 +00:00
</a>
</template>
<script>
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
export default {
name: 'TopItem',
components: {},
props: {
xmlUrl: {
type: String,
required: true,
},
imgUrl: {
type: String,
required: true,
},
author: {
type: String,
required: true,
},
},
methods: {
async addSubscription() {
try {
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.xmlUrl], remove: [] })
} catch (e) {
console.error(e)
showError(t('Error while adding the feed'))
}
this.$store.dispatch('subscriptions/fetch')
},
},
}
</script>
<style scoped>
img {
height: 100%;
width: 100%;
}
</style>