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

View File

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

View File

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