20 lines
572 B
Dart
20 lines
572 B
Dart
import 'package:http/http.dart' as http;
|
|
import 'package:http_interceptor/http_interceptor.dart';
|
|
import 'package:pvt15/services/api_interceptor.dart';
|
|
import 'package:pvt15/services/auth/auth_service.dart';
|
|
|
|
// Använd AuthClient för att göra anrop med interceptorn
|
|
class AuthClient {
|
|
final http.Client _client;
|
|
|
|
AuthClient({required AuthService authService})
|
|
: _client = InterceptedClient.build(
|
|
interceptors: [AuthInterceptor(authService: authService)],
|
|
);
|
|
|
|
http.Client get client => _client;
|
|
|
|
void close() {
|
|
_client.close();
|
|
}
|
|
} |