import { server } from "@/utils/client";

export interface loginParams {
    /**
     * 用户密码
     */
    pwd: string;
    /**
     * 用户电话号码
     */
    user_phone: string;

    referrer_code?: string;
}
export interface EntityTokenResp {
    /**
     * 用户头像
     */
    avatar_url?: string;
    /**
     * 用户ID
     */
    id?: number;
    token?: string;
    /**
     * 用户名
     */
    user_name?: string;
}

export const loginApi = (data: loginParams) => {
    return server.request<EntityTokenResp>({
        url: "/v1/api/user/login",
        data: data,
        method: "POST",
    });
};

export const userInfoApi = () => {
    return server.request<any>({
        url: "/v1/api/user/user_info",
        method: "POST",
    });
};
// 前台用户注册
// POST /v1/api/user/register
// 接口ID：193951229
// 接口地址：https://app.apifox.com/link/project/4790544/apis/api-193951229
export const registerApi = (data: loginParams) => {
    return server.request({
        url: "/v1/api/user/register",
        data: data,
        method: "POST",
    });
};
