TRM-coding | 29174c2 | 2025-06-18 23:56:51 +0800 | [diff] [blame] | 1 | import axios from 'axios'; |
| 2 | |
| 3 | const api = axios.create({ |
| 4 | baseURL: 'http://10.126.59.25:5715/api/', |
| 5 | withCredentials: true |
| 6 | }); |
| 7 | |
| 8 | // 用户相关API |
| 9 | export const getCurrentUser = () => api.get('/current-user'); |
| 10 | export const getUser = (userId) => api.get(`/user/${userId}`); |
| 11 | export const updateUser = (userId, data) => api.put(`/user/${userId}`, data); |
| 12 | |
| 13 | // 收藏相关API |
| 14 | export const getFavorites = (userId) => api.get(`/user/${userId}/favorites`); |
| 15 | |
| 16 | // 关注相关API |
| 17 | export const followUser = (followeeId) => api.post(`/follow/${followeeId}`); |
| 18 | export const unfollowUser = (followeeId) => api.delete(`/follow/${followeeId}`); |
| 19 | |
| 20 | // 帖子相关API |
| 21 | export const getUserPosts = (userId) => api.get(`/user/${userId}/posts`); |
| 22 | |
| 23 | // 关注列表API |
| 24 | export const getUserFollowing = (userId) => api.get(`/user/${userId}/following`); |
| 25 | |
| 26 | // 用户互动数据API |
| 27 | export const getUserInteractions = (userId) => api.get(`/user/${userId}/interactions`); |
| 28 | // 获取粉丝 |
| 29 | export const getUserFollowers = (userId) => api.get(`/user/${userId}/followers`); |
| 30 | |
| 31 | export default api; |