定义api

This commit is contained in:
2025-09-19 14:34:51 +08:00
parent fbf3f77229
commit 1e894b7700
5 changed files with 172 additions and 6 deletions

26
src/api/user.js Normal file
View File

@@ -0,0 +1,26 @@
import http from '../utils/http.js';
/**
* 用户管理API
*/
export class UserApi {
/**
* 创建新用户
* @param {Object} userData 用户数据
* @returns {Promise} 创建结果
*/
static create(userData) {
return http.post('/users', userData);
}
/**
* 用户登录
* @param {Object} credentials 登录凭证 {username, password}
* @returns {Promise} 登录结果
*/
static login(credentials) {
return http.post('/users/login', credentials);
}
}
export default UserApi;