api보드리스트 수정정
This commit is contained in:
parent
d87a87450a
commit
68d1b41f11
@ -49,18 +49,17 @@ const filteredList = computed(() =>
|
|||||||
|
|
||||||
// 게시물 데이터 로드
|
// 게시물 데이터 로드
|
||||||
const fetchPosts = async () => {
|
const fetchPosts = async () => {
|
||||||
try {
|
const response = await axios.get("board/general");
|
||||||
const response = await axios.get("board/general");
|
console.log(response.data.data.list)
|
||||||
if (response.data && Array.isArray(response.data.data)) {
|
if (response.data && response.data.data && Array.isArray(response.data.data.list)) {
|
||||||
list.value = response.data.data.map((post) => ({
|
list.value = response.data.data.list.map((post) => ({
|
||||||
...post,
|
...post,
|
||||||
img: post.img || null,
|
img: post.img || null,
|
||||||
likes: post.likes || 0,
|
likes: post.likes || 0,
|
||||||
comments: post.comments || 0,
|
comments: post.comments || 0,
|
||||||
}));
|
}));
|
||||||
}
|
} else {
|
||||||
} catch (error) {
|
console.error("Unexpected API response structure:", response.data);
|
||||||
console.error("Failed to fetch posts:", error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user