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.
paopao-ce/web/src/api/auth.ts

63 lines
1.2 KiB

3 years ago
import request from '@/utils/request';
/**
*
* @param {Object} params
* - @param {string} username
* - @param {string} password
* @returns Promise
*/
export const userLogin = (params: NetParams.AuthUserLogin = {}) => {
3 years ago
return request({
method: 'post',
url: '/auth/login',
data: params,
}) 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
*/
export const updateUserPassword = (data: any) => {
3 years ago
return request({
method: 'post',
url: '/api/user/password',
data,
});
};