import 'package:app/request/dto/user/user_info_dto.dart';
import 'package:app/request/network/request.dart';

import '../dto/user/login_dto.dart';

///发送验证码
Future<void> sendCodeApi(String tel) async {
  await Request().get("/send_sms_code", {"tel": tel});
}

///登录
Future<LoginDto> loginApi(String tel, String code) async {
  var res = await Request().post("/login", {
    "tel": tel,
    "sms_code": code,
  });
  return LoginDto.fromJson(res);
}

/// 获取用户信息
Future<UserInfoDto> getUserInfoApi() async {
  var response = await Request().get("/get_my_info");
  return UserInfoDto.fromJson(response);
}

///退出登录
Future<void> logoutApi() async {
  await Request().get("/logout");
}