part of user_info;

class UserInfoController extends GetxController {
  final UserInfoModel userInfo;
  UserInfoController(this.userInfo);

  /// 上传头像
  void upload({
    required String path
  }) async {
     String result  = await CommonAPI.upload(path:path,fileTypes: 'user');
     _changeInfo(result);
  }

  /// 修改用用户信息
  void _changeInfo(String img) async {
    final result = await MineAPI.changeInfo(headImg: img);
    if(result){
      Toast.show('修改成功');
      userInfo.headImg = img;
      update();
    }
  }


}