import request from "@/utils/request";

/**
 * 登录功能
 * @param userName
 * @param password
 * @param verifyCode
 * @param uid
 * @returns {AxiosPromise}
 */
export function login(userName, password, verifyCode, uid) {
    const data = {
        userName,
        password,
        verifyCode,
        uid
    }
    return request({
        url: '/user/frontUserLogin',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

/**
 * 退出登录
 * @returns {AxiosPromise}
 */
export function logout() {
    return request({
        url: '/user/userLoginOut',
        headers: {
            isToken: true
        },
        method: 'post'
    })
}

/**
 * 获取公钥
 * @returns {AxiosPromise}
 */
export function getPublicKey() {
    return request({
        url: '/user/getPublicKey',
        headers: {
            isToken: false
        },
        method: 'get'
    })
}

/**
 * 获取验证码
 * @returns {AxiosPromise}
 */
export function getCode() {
    return request({
        url: '/user/getCodeImage',
        headers: {
            isToken: false
        },
        method: 'get'
    })
}