import 'Network/HttpManager.dart';
import 'Network/BaseHttpModel.dart';
import 'UserModel.dart';

/// 所有接口类
class LoginApi {
  ///示例请求
  static loginRequest(Map<String, dynamic> param, OnResult onResult) {
    return HttpManager.getInstance().request('auth/oauth/token', parameters: param, onResult: (data,errorMsg){
      BaseHttpModel httpModel = data;
      UserModel userModel = UserModel.fromJson(httpModel.data);
      UserModel.saveModel(userModel);
      print(UserModel.getModel().token);
      if(onResult != null){
        onResult(data, errorMsg);
      }
    });
  }
}
