together_mobile/lib/request/user_account.dart

70 lines
1.3 KiB
Dart

import 'package:dio/dio.dart';
import 'server.dart';
Future<Map<String, dynamic>> changeUsername(String id, String username) async {
Response response = await request.post(
'/user_account/change/username',
data: {
'id': id,
'username': username,
},
);
return response.data;
}
Future<Map<String, dynamic>> getChangeEmailCode(String email) async {
Response response = await request.get(
'/user_account/get/email_code',
queryParameters: {'email': email},
);
return response.data;
}
Future<Map<String, dynamic>> changeEmail(
String id,
String email,
String code,
) async {
Response response = await request.post(
'/user_account/change/email',
data: {
'id': id,
'email': email,
'code': code,
},
);
return response.data;
}
Future<Map<String, dynamic>> getChangePasswordCode(String email) async {
Response response = await request.get(
'/user_account/get/password_code',
queryParameters: {'email': email},
);
return response.data;
}
Future<Map<String, dynamic>> changePassword(
String id,
String password,
String email,
String code,
) async {
Response response = await request.post(
'/user_account/change/password',
data: {
'id': id,
'email': email,
'code': code,
'password': password,
},
);
return response.data;
}