2025-09-19 14:34:51 +08:00
|
|
|
import http from '../utils/http.js';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户管理API
|
|
|
|
|
*/
|
|
|
|
|
export class UserApi {
|
|
|
|
|
/**
|
|
|
|
|
* 创建新用户
|
|
|
|
|
* @param {Object} userData 用户数据
|
|
|
|
|
* @returns {Promise} 创建结果
|
|
|
|
|
*/
|
|
|
|
|
static create(userData) {
|
2025-09-19 15:59:44 +08:00
|
|
|
return http.post('/api/v1/users', userData);
|
2025-09-19 14:34:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户登录
|
|
|
|
|
* @param {Object} credentials 登录凭证 {username, password}
|
|
|
|
|
* @returns {Promise} 登录结果
|
|
|
|
|
*/
|
|
|
|
|
static login(credentials) {
|
2025-09-19 15:59:44 +08:00
|
|
|
return http.post('/api/v1/users/login', credentials);
|
2025-09-19 14:34:51 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default UserApi;
|