30 lines
920 B
Dart
30 lines
920 B
Dart
import 'api_client.dart';
|
|
|
|
class AuthApi {
|
|
final ApiClient _client;
|
|
AuthApi(this._client);
|
|
|
|
Future<Map<String, dynamic>> login(String phone, String password) {
|
|
return _client.post('/auth/login', data: {'phone': phone, 'password': password});
|
|
}
|
|
|
|
Future<Map<String, dynamic>> register(String phone, String password, String nickname) {
|
|
return _client.post('/auth/register', data: {'phone': phone, 'password': password, 'nickname': nickname});
|
|
}
|
|
|
|
Future<Map<String, dynamic>> logout() {
|
|
return _client.post('/auth/logout');
|
|
}
|
|
|
|
Future<Map<String, dynamic>> getProfile() {
|
|
return _client.get('/user/profile');
|
|
}
|
|
|
|
Future<Map<String, dynamic>> bindEmail(String email) {
|
|
return _client.put('/user/email', data: {'email': email});
|
|
}
|
|
|
|
Future<Map<String, dynamic>> switchActiveFamily(String? familyId) {
|
|
return _client.put('/user/active-family', data: {'familyId': familyId});
|
|
}
|
|
} |