feat: get aka too
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { getAka } from "@/modules/atproto/getAka"
|
||||||
import { PublicNoteListItem } from "@/modules/note/models/Note"
|
import { PublicNoteListItem } from "@/modules/note/models/Note"
|
||||||
import { useAsyncState } from "@vueuse/core"
|
import { computedAsync, useAsyncState } from "@vueuse/core"
|
||||||
|
|
||||||
const { state, isLoading } = useAsyncState<{
|
const { state, isLoading } = useAsyncState<{
|
||||||
notes: PublicNoteListItem[]
|
notes: PublicNoteListItem[]
|
||||||
@@ -11,6 +12,15 @@ const { state, isLoading } = useAsyncState<{
|
|||||||
},
|
},
|
||||||
{ notes: [] },
|
{ notes: [] },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const aka = computedAsync<Map<string, string>>(async () => {
|
||||||
|
if (state.value.notes.length === 0) {
|
||||||
|
return new Map()
|
||||||
|
}
|
||||||
|
return getAka(new Set(state.value.notes.map((n) => n.did)))
|
||||||
|
}, new Map())
|
||||||
|
|
||||||
|
const getAlias = (did: string) => aka.value.get(did) ?? ""
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -18,7 +28,7 @@ const { state, isLoading } = useAsyncState<{
|
|||||||
<div class="public-note-view" v-else>
|
<div class="public-note-view" v-else>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="note in state.notes">
|
<li v-for="note in state.notes">
|
||||||
{{ note.did }}/{{ note.rkey }}: {{ note.title }}
|
{{ getAlias(note.did) }}: {{ note.title }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user