27 lines
995 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 导入api对象它包含了所有API端点的路径
// 这些端点应该在index.js文件中定义以便于统一管理
import api from './index';
// 导入axios库用于发送HTTP请求
import { axios } from '../utils/request';
// 定义登录函数
// 该函数接收一个参数对象,包含登录所需的信息
export function login(parameter) {
// 使用axios发送POST请求到用户登录的API端点
return axios({
url: api.UserLogin, // 用户登录的API端点
method: 'post', // 请求方法为POST
data: parameter // 发送到服务器的数据,即登录参数
});
}
// 定义注册函数
// 该函数接收一个参数对象,包含注册所需的信息
export function register(parameter) {
// 使用axios发送POST请求到用户注册的API端点
return axios({
url: api.UserRegister, // 用户注册的API端点
method: 'post', // 请求方法为POST
data: parameter // 发送到服务器的数据,即注册参数
});
}