etape4
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:http/http.dart' as http;
|
||||
import '../config/intra_config.dart';
|
||||
import 'intra_api_exception.dart';
|
||||
import 'intra_auth_service.dart';
|
||||
import 'intra_http.dart';
|
||||
|
||||
class IntraUserService {
|
||||
IntraUserService._();
|
||||
@@ -28,7 +29,10 @@ class IntraUserService {
|
||||
);
|
||||
|
||||
try {
|
||||
final response = await http.get(uri, headers: _auth.authHeaders());
|
||||
final response = await intraApiGet(
|
||||
uri,
|
||||
headers: _auth.authHeaders(),
|
||||
);
|
||||
return _parseUserListResponse(response, trimmed);
|
||||
} on IntraApiException {
|
||||
rethrow;
|
||||
@@ -43,14 +47,7 @@ class IntraUserService {
|
||||
http.Response response,
|
||||
String login,
|
||||
) {
|
||||
if (response.statusCode == 401) {
|
||||
throw const IntraUnauthorizedException();
|
||||
}
|
||||
if (response.statusCode != 200) {
|
||||
throw IntraApiErrorException(
|
||||
'Erreur API (${response.statusCode})',
|
||||
);
|
||||
}
|
||||
ensureIntraOk(response);
|
||||
|
||||
final decoded = jsonDecode(response.body);
|
||||
if (decoded is! List) {
|
||||
|
||||
Reference in New Issue
Block a user