fix(board): unwrap API envelope in composables, isolate member profile fetch
This commit is contained in:
parent
f8bc5502ba
commit
4b3ba411dd
3 changed files with 7 additions and 8 deletions
|
|
@ -7,7 +7,7 @@ export function useBoardChannels() {
|
||||||
|
|
||||||
async function fetchChannels() {
|
async function fetchChannels() {
|
||||||
const result = await $fetch('/api/board/channels')
|
const result = await $fetch('/api/board/channels')
|
||||||
channels.value = result || []
|
channels.value = result?.channels || []
|
||||||
return channels.value
|
return channels.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export function useBoardPosts() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const result = await $fetch('/api/board/posts', { params })
|
const result = await $fetch('/api/board/posts', { params })
|
||||||
posts.value = result || []
|
posts.value = result?.posts || []
|
||||||
return posts.value
|
return posts.value
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
|
|
||||||
|
|
@ -249,12 +249,11 @@ const tagLabel = (pool, slug) => {
|
||||||
const craftTagsDisplay = computed(() => member.value?.craftTags || []);
|
const craftTagsDisplay = computed(() => member.value?.craftTags || []);
|
||||||
|
|
||||||
// Board posts authored by this member
|
// Board posts authored by this member
|
||||||
const memberPosts = ref([]);
|
const { data: postsData } = useFetch(`/api/board/posts`, {
|
||||||
onMounted(async () => {
|
params: { author: id },
|
||||||
const { fetchPosts } = useBoardPosts();
|
default: () => ({ posts: [] }),
|
||||||
const result = await fetchPosts({ author: id });
|
})
|
||||||
memberPosts.value = result || [];
|
const memberPosts = computed(() => postsData.value?.posts || [])
|
||||||
});
|
|
||||||
|
|
||||||
const postExcerpt = (post) => {
|
const postExcerpt = (post) => {
|
||||||
const text = post.seeking || post.offering || "";
|
const text = post.seeking || post.offering || "";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue