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