feat: get aka too

This commit is contained in:
Julien Calixte
2026-02-10 20:24:04 +01:00
parent 63903d48eb
commit 9d48329a30

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { getAka } from "@/modules/atproto/getAka"
import { PublicNoteListItem } from "@/modules/note/models/Note"
import { useAsyncState } from "@vueuse/core"
import { computedAsync, useAsyncState } from "@vueuse/core"
const { state, isLoading } = useAsyncState<{
notes: PublicNoteListItem[]
@@ -11,6 +12,15 @@ const { state, isLoading } = useAsyncState<{
},
{ 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>
<template>
@@ -18,7 +28,7 @@ const { state, isLoading } = useAsyncState<{
<div class="public-note-view" v-else>
<ul>
<li v-for="note in state.notes">
{{ note.did }}/{{ note.rkey }}: {{ note.title }}
{{ getAlias(note.did) }}: {{ note.title }}
</li>
</ul>
</div>