mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.2 KiB
63 lines
1.2 KiB
3 years ago
|
import request from '@/utils/request';
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 用户登录
|
||
|
* @param {Object} params
|
||
|
* - @param {string} username
|
||
|
* - @param {string} password
|
||
|
* @returns Promise
|
||
|
*/
|
||
3 years ago
|
export const userLogin = (params: NetParams.AuthUserLogin = {}) => {
|
||
3 years ago
|
return request({
|
||
|
method: 'post',
|
||
|
url: '/auth/login',
|
||
|
data: params,
|
||
3 years ago
|
}) as unknown as Promise<NetReq.AuthUserLogin>;
|
||
3 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
* 注册用户
|
||
|
* @param {Object} params
|
||
|
* - @param {string} username
|
||
|
* - @param {string} password
|
||
|
* @returns Promise
|
||
|
*/
|
||
|
export const userRegister = (params = {}) => {
|
||
|
return request({
|
||
|
method: 'post',
|
||
|
url: '/auth/register',
|
||
|
data: params,
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 用户信息
|
||
|
* @param {Object} params
|
||
|
* @returns Promise
|
||
|
*/
|
||
|
export const userInfo = (token = '') => {
|
||
|
return request({
|
||
|
method: 'get',
|
||
|
url: '/user/info',
|
||
|
headers: {
|
||
|
Authorization: `Bearer ${token}`,
|
||
|
},
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 修改用户密码
|
||
|
* @param {Object} params
|
||
|
* - @param {string} password 新密码
|
||
|
* - @param {string} old_password 旧密码
|
||
|
* @returns Promise
|
||
|
*/
|
||
3 years ago
|
export const updateUserPassword = (data: any) => {
|
||
3 years ago
|
return request({
|
||
|
method: 'post',
|
||
|
url: '/api/user/password',
|
||
|
data,
|
||
|
});
|
||
|
};
|