TF-571 Update token for interceptors dio
This commit is contained in:
@@ -75,7 +75,6 @@ export 'presentation/constants/constants_ui.dart';
|
||||
export 'data/constants/constant.dart';
|
||||
|
||||
// Network
|
||||
export 'data/network/config/authorization_interceptors.dart';
|
||||
export 'data/network/config/dynamic_url_interceptors.dart';
|
||||
export 'data/network/config/service_path.dart';
|
||||
export 'data/network/dio_client.dart';
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class AuthorizationInterceptors extends InterceptorsWrapper {
|
||||
String? _authorization;
|
||||
|
||||
String getBasicAuth() => _authorization ?? '';
|
||||
|
||||
void changeAuthorization(String? userName, String? password) {
|
||||
_authorization = base64Encode(utf8.encode('$userName:$password'));
|
||||
}
|
||||
|
||||
@override
|
||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||
if (_authorization != null) {
|
||||
options.headers[HttpHeaders.authorizationHeader] = 'Basic $_authorization';
|
||||
}
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user