Skip to content

Commit 1948356

Browse files
committed
Refactor feedId usage in Votes.vue
Eliminated the unnecessary ref property 'feedId' and directly referenced the 'feed.id' from the 'fetchPolls' function parameters. This simplification enhances the code readability and prevent potential errors from handling feedId separately.
1 parent 7f38ed8 commit 1948356

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/components/Pages/Votes.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,20 @@ type PostsPlus = Posts & {
3333
stripedMarkdown: string
3434
}
3535
36-
const feedId = ref('')
37-
3836
const fetchPolls = async (feed: OptionsDatabase): Promise<Polls> => {
39-
feedId.value = feed.id
4037
const title = feed.title
4138
4239
const url = new URL(
43-
`/api/${postsPluginId}/${feedId.value}/search/has:option/%23poll`,
40+
`/api/${postsPluginId}/${feed.id}/search/has:option/%23poll`,
4441
window.location.origin,
4542
)
4643
4744
const res = await fetch(url.toString())
4845
const json = await res.json()
4946
5047
return {
51-
title: title ? title : feedId.value,
48+
title: title ? title : feed.id,
49+
feedId: feed.id,
5250
values: decode(json.contents),
5351
}
5452
}
@@ -89,7 +87,7 @@ onMounted(async () => {
8987
<a
9088
v-for="post in poll.values"
9189
:key="post.id"
92-
:href="`/posts/${feedId}/${post.id}`"
90+
:href="`/posts/${poll.feedId}/${post.id}`"
9391
class="block mb-4 p-2 bg-gray-100 rounded"
9492
>
9593
<div class="flex justify-between gap-2">

0 commit comments

Comments
 (0)