ASWImplementation constructor
ASWImplementation({
- required Dio dio,
- List<
Interceptor> ? interceptors, - Future<
Either< tokenRefreshCallback(String, ASWTokenPair> >- String refreshToken
- VoidCallback? onTokenExpired,
Implementation
ASWImplementation({
required this.dio,
this.interceptors,
this.tokenRefreshCallback,
this.onTokenExpired,
}) : _tokenManager = ASWTokenManager.instance {
final allInterceptors = [...?interceptors];
if (!allInterceptors.any(
(interceptor) => interceptor is ASWTokenInterceptor,
)) {
allInterceptors.add(
ASWTokenInterceptor(
tokenManager: _tokenManager,
tokenRefreshCallback: tokenRefreshCallback,
onTokenExpired: onTokenExpired,
),
);
}
dio.interceptors.addAll(allInterceptors);
}