blob: 1adea994851e2444172084db45502770f009189f [file] [log] [blame]
TRM-coding29174c22025-06-18 23:56:51 +08001import axios from 'axios';
22301008e25b4b02025-06-20 22:15:31 +08002import { getUserInfo } from '../utils/auth';
TRM-coding29174c22025-06-18 23:56:51 +08003
4const api = axios.create({
5 baseURL: 'http://10.126.59.25:5715/api/',
6 withCredentials: true
7});
8
9// 用户相关API
10export const getCurrentUser = () => api.get('/current-user');
11export const getUser = (userId) => api.get(`/user/${userId}`);
12export const updateUser = (userId, data) => api.put(`/user/${userId}`, data);
13
14// 收藏相关API
15export const getFavorites = (userId) => api.get(`/user/${userId}/favorites`);
16
17// 关注相关API
22301008e25b4b02025-06-20 22:15:31 +080018export const followUser = (followeeId) => {
19 return api.post(`/follow/${followeeId}`);
20};
21export const unfollowUser = (followeeId) => {
22 return api.delete(`/follow/${followeeId}`);
23};
TRM-coding29174c22025-06-18 23:56:51 +080024
25// 帖子相关API
26export const getUserPosts = (userId) => api.get(`/user/${userId}/posts`);
27
28// 关注列表API
29export const getUserFollowing = (userId) => api.get(`/user/${userId}/following`);
30
31// 用户互动数据API
32export const getUserInteractions = (userId) => api.get(`/user/${userId}/interactions`);
33// 获取粉丝
34export const getUserFollowers = (userId) => api.get(`/user/${userId}/followers`);
35
36export default api;