25 lines
700 B
Dart
25 lines
700 B
Dart
import '../model/auth_model.dart';
|
|
import 'base_repository.dart';
|
|
|
|
class AuthRepository extends BaseRepository {
|
|
AuthRepository({required super.dio});
|
|
|
|
Future<AuthModel> login({
|
|
required String username,
|
|
required String host,
|
|
required String password,
|
|
}) async {
|
|
final param = {"username": username, "password": password};
|
|
// final service = "${Constant.baseUrl}xauth/login";
|
|
final service = "http://$host/one-api/v1/system/auth/login";
|
|
final resp = await post(param: param, service: service);
|
|
|
|
final result = AuthModel(
|
|
host: host,
|
|
token: resp["data"]["token"],
|
|
model: UserModel.fromJson(resp["data"]["user"]),
|
|
);
|
|
return result;
|
|
}
|
|
}
|