fix: hashtag id

This commit is contained in:
三咲智子 2023-01-07 22:21:48 +08:00
parent 30e4ef57df
commit d386a2dbbe
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
5 changed files with 9 additions and 7 deletions

View file

@ -42,7 +42,7 @@ const searchResult = $computed<QueryResult>(() => {
const hashtagList = hashtags.value.slice(0, 3)
.map<HashTagResult>(hashtag => ({
type: 'hashtag',
id: hashtag.id,
id: `hashtag-${hashtag.name}`,
hashtag,
to: getTagRoute(hashtag.name),
}))

View file

@ -1,7 +1,9 @@
<script setup lang="ts">
import type { Tag } from 'masto'
const { hashtag } = defineProps<{ hashtag: Tag }>()
const { hashtag } = defineProps<{
hashtag: Tag
}>()
const totalTrend = $computed(() =>
hashtag.history?.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),

View file

@ -17,7 +17,7 @@ const results = computed(() => {
const results = [
...hashtags.value.slice(0, 3).map<HashTagResult>(hashtag => ({
type: 'hashtag',
id: hashtag.id,
id: `hashtag-${hashtag.name}`,
hashtag,
to: getTagRoute(hashtag.name),
})),

View file

@ -1,4 +1,4 @@
import type { Account, Status } from 'masto'
import type { Account, Status, Tag } from 'masto'
import type { RouteLocation } from 'vue-router'
export type BuildResult<K extends keyof any, T> = {
@ -10,7 +10,7 @@ export type BuildResult<K extends keyof any, T> = {
href: string
}
}
export type HashTagResult = BuildResult<'hashtag', any>
export type HashTagResult = BuildResult<'hashtag', Tag>
export type AccountResult = BuildResult<'account', Account>
export type StatusResult = BuildResult<'status', Status>