step 7 : proses login dan refactor struktur folder

This commit is contained in:
sindhu
2025-02-15 17:17:19 +07:00
parent c3d906653a
commit 823f1aa525
13 changed files with 471 additions and 80 deletions

View File

@@ -0,0 +1,23 @@
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(
token: resp["data"]["token"],
model: UserModel.fromJson(resp["data"]["user"]),
);
return result;
}
}