2023-07-25 20:07:35 +00:00
|
|
|
<template>
|
|
|
|
<a @click="addSubscription">
|
2023-08-01 21:18:37 +00:00
|
|
|
<img :alt="`${title} - ${author}`"
|
2023-08-22 18:14:15 +00:00
|
|
|
:src="imageUrl"
|
2023-07-29 15:53:51 +00:00
|
|
|
: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: {
|
2023-08-01 21:18:37 +00:00
|
|
|
author: {
|
2023-07-25 20:07:35 +00:00
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2023-08-22 18:14:15 +00:00
|
|
|
imageUrl: {
|
2023-07-25 20:07:35 +00:00
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2023-08-22 18:14:15 +00:00
|
|
|
link: {
|
2023-08-01 21:18:37 +00:00
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2023-08-22 18:14:15 +00:00
|
|
|
title: {
|
2023-07-25 20:07:35 +00:00
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async addSubscription() {
|
|
|
|
try {
|
2023-08-22 18:14:15 +00:00
|
|
|
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.link], remove: [] })
|
2023-07-25 20:07:35 +00:00
|
|
|
} 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>
|