|
|
|
@ -220,10 +220,10 @@
|
|
|
|
|
// 并发请求每个 follow 的用户信息(用户名和头像)
|
|
|
|
|
const followsWithUserInfo = await Promise.all(
|
|
|
|
|
response.map(async (follow) => {
|
|
|
|
|
const { userid: followUserid } = follow;
|
|
|
|
|
const { myfollowid } = follow;
|
|
|
|
|
try {
|
|
|
|
|
// 获取每个 follow 的用户信息(包括用户名和头像)
|
|
|
|
|
const userResponse = await axios.get(`/user/info/${id}`);
|
|
|
|
|
const userResponse = await axios.get(`/user/info/${myfollowid}`);
|
|
|
|
|
const { username, photo } = userResponse;
|
|
|
|
|
|
|
|
|
|
// 返回包含用户名和头像的 follow 对象
|
|
|
|
@ -233,7 +233,7 @@
|
|
|
|
|
photo
|
|
|
|
|
};
|
|
|
|
|
} catch (userError) {
|
|
|
|
|
console.error(`Error fetching user info for follow with userid ${followUserid}:`, userError);
|
|
|
|
|
console.error(`Error fetching user info for follow with userid ${myfollowid}:`, userError);
|
|
|
|
|
return {
|
|
|
|
|
...follow,
|
|
|
|
|
username: 'Unknown', // 如果失败,设置默认的用户名
|
|
|
|
@ -385,7 +385,7 @@
|
|
|
|
|
const { userid } = comment;
|
|
|
|
|
try {
|
|
|
|
|
// 获取用户信息
|
|
|
|
|
const userResponse = await axios.get(`/user/info/${id}`);
|
|
|
|
|
const userResponse = await axios.get(`/user/info/${userid}`);
|
|
|
|
|
const username = userResponse.username; // 假设用户名在 response.data.username 中
|
|
|
|
|
|
|
|
|
|
// 返回包含用户名的评论对象
|
|
|
|
|