File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -30,19 +30,26 @@ class HtHttpClient {
3030 HtHttpClient ({
3131 required String baseUrl,
3232 required TokenProvider tokenProvider,
33+ required bool isWeb,
3334 Dio ? dioInstance,
3435 List <Interceptor >? interceptors,
3536 }) : _dio = dioInstance ?? Dio () {
3637 // Configure base options
37- _dio.options = BaseOptions (
38+ final baseOptions = BaseOptions (
3839 baseUrl: baseUrl,
39- connectTimeout: const Duration (seconds: 15 ), // Example timeout
40- receiveTimeout: const Duration (seconds: 15 ), // Example timeout
41- sendTimeout: const Duration (seconds: 15 ), // Example timeout
4240 // Headers can be set here, but AuthInterceptor handles Authorization
4341 // headers: {'Content-Type': 'application/json'},
4442 );
4543
44+ if (! isWeb) {
45+ baseOptions
46+ ..connectTimeout = const Duration (seconds: 15 )
47+ ..receiveTimeout = const Duration (seconds: 15 )
48+ ..sendTimeout = const Duration (seconds: 15 );
49+ }
50+
51+ _dio.options = baseOptions;
52+
4653 // Add default interceptors
4754 _dio.interceptors.addAll ([
4855 AuthInterceptor (tokenProvider: tokenProvider),
You can’t perform that action at this time.
0 commit comments