import { request } from '@/utils/request';

enum Api {
  Login = '/boyanghu/iotree-service/platform/login',
}

/**
 * @description: 登录接口参数
 */
export interface LoginParams {
  phone: string;
  type: number; // 0短信 1密码
  code?: string;
  password?: string;
}

/**
 * @description: 用户登录
 */
export function loginApi(params: LoginParams) {
  return request({
    url: Api.Login,
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    data: params,
  });
}
