1
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../data/models/other_login_type.dart';
|
||||
import '../dto/login_dto.dart';
|
||||
@@ -53,3 +54,25 @@ Future<LoginDto> thirdLoginApi(String token, OtherLoginType type) async {
|
||||
Future<void> deleteAccountApi() async {
|
||||
return Request().get("/delete_account");
|
||||
}
|
||||
|
||||
///修改用户资料
|
||||
Future<UserInfo> updateUserInfoApi({
|
||||
String? name,
|
||||
List<int>? avatar,
|
||||
String? description,
|
||||
}) async {
|
||||
FormData formData = FormData.fromMap({
|
||||
"avatar": avatar != null
|
||||
? MultipartFile.fromBytes(
|
||||
avatar,
|
||||
filename: "upload.jpg",
|
||||
contentType: DioMediaType("image", "jpeg"),
|
||||
)
|
||||
: null,
|
||||
"description": description,
|
||||
"name": name,
|
||||
});
|
||||
//请求
|
||||
var res = await Request().post("/user/update_profile", formData);
|
||||
return UserInfo.fromJson(res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user