41 lines
1.2 KiB
Dart
41 lines
1.2 KiB
Dart
|
|
import 'package:novyronst/common/api/api_request.dart';
|
|
import 'package:novyronst/common/api/api_string.dart';
|
|
import 'package:novyronst/common/help/help_log.dart';
|
|
import 'package:novyronst/common/model/novyronst_user.dart';
|
|
import 'package:novyronst/common/model/register_model.dart';
|
|
|
|
class UserRequest {
|
|
|
|
static Future login() {
|
|
final body = <String, dynamic>{
|
|
"avator": '',
|
|
"email": '123456@qq.com',
|
|
"family_name": 'test1',
|
|
"platform": 'android',
|
|
"third_id": '32434',
|
|
};
|
|
return ApiRequest.post(ApiStringUser.login, data: body).then((value) {
|
|
HelpLog.print(value.data, tag: 'loginnnn');
|
|
});
|
|
}
|
|
|
|
static Future<RegisterModel?> register() {
|
|
return ApiRequest.post(ApiStringUser.register).then((value) {
|
|
if (value.isSuccess) {
|
|
return RegisterModel.fromJson(value.data['data']);
|
|
}
|
|
return null;
|
|
});
|
|
}
|
|
|
|
static Future<NovyronstUser?> getUserInfo() {
|
|
return ApiRequest.get(ApiStringUser.userInfo).then((value) {
|
|
if (value.isSuccess) {
|
|
HelpLog.print(value.data, tag: 'getUserInfo');
|
|
return NovyronstUser.fromJson(value.data['data']);
|
|
}
|
|
return null;
|
|
});
|
|
}
|
|
} |