refacto: move hash to computed values

This commit is contained in:
Michel Roux 2024-01-14 00:33:23 +01:00
parent 47e44bdaf5
commit 1c566b19cb
3 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<template>
<router-link :to="toUrl(link)">
<router-link :to="hash">
<img :src="imageUrl" :title="author">
</router-link>
</template>
@ -27,8 +27,10 @@ export default {
required: true,
},
},
methods: {
toUrl,
computed: {
hash() {
return toUrl(this.link)
},
},
}
</script>

View File

@ -3,7 +3,7 @@
<a :href="player.episode.link" target="_blank">
<strong>{{ player.episode.name }}</strong>
</a>
<router-link :to="toUrl(player.podcastUrl)">
<router-link :to="hash">
<i>{{ player.episode.podcast }}</i>
</router-link>
</div>
@ -18,9 +18,9 @@ export default {
player() {
return this.$store.state.player
},
},
methods: {
toUrl,
hash() {
return toUrl(this.player.podcastUrl)
},
},
}
</script>

View File

@ -1,7 +1,7 @@
<template>
<NcAppNavigationItem :loading="loading"
:name="feed ? feed.title : url"
:to="toUrl(url)">
:to="hash">
<template #icon>
<NcAvatar v-if="feed"
:display-name="feed.author || feed.title"
@ -51,6 +51,11 @@ export default {
feed: null,
}
},
computed: {
hash() {
return toUrl(this.url)
},
},
async mounted() {
try {
const podcastData = await axios.get(generateUrl('/apps/gpoddersync/personal_settings/podcast_data?url={url}', { url: this.url }))
@ -63,7 +68,6 @@ export default {
}
},
methods: {
toUrl,
async deleteSubscription() {
if (confirm(t('repod', 'Are you sure you want to delete this subscription?'))) {
try {