#first commit

This commit is contained in:
cc
2026-01-11 19:42:22 +08:00
commit f70d6cace6
167 changed files with 6699 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import 'package:dio/dio.dart';
import '../../models/user_model.dart';
import '../auth_http_datasource.dart';
class AuthHttpDataSourceImpl implements AuthHttpDataSource {
final Dio dio;
AuthHttpDataSourceImpl(this.dio);
@override
Future<UserModel> login(String username, String password, sourceType) async {
final response = await dio.post(
'/auth',
data: {
'username': username,
'password': password,
'sourceType': sourceType,
},
);
if (response.statusCode == 200) {
print('runtimeType = ${response.data.runtimeType}');
return UserModel.fromJson(response.data);
} else {
throw Exception(response.data['message'] ?? 'Login failed');
}
}
}