/**
 * 授权认证系统的相关接口
 */
import { request } from '../../axios';
import qs from 'qs';
import CFG from '../../const';

export function getPersonInfo() {
    return request({
        url:'/v1/person/info',
        method: 'get',
    }).then(resp=>resp.data)
}


/**
 * 授权认证
 * @param data.username
 * @param data.password
 * @return Promise
 */
export function authLogin(data) {
    return request({
        url: '/oauth/token',
        method: 'post',
        headers: { 'content-type': 'application/x-www-form-urlencoded' },
        data: qs.stringify({
            response_type: 'password',
            clientId: CFG.CLIENT_ID,
            clientSecret: CFG.CLIENT_SECRET,
            ...data,
        }),
    }).then(resp => resp.data);
}
