Skip to content

Commit

Permalink
chore(ml-opensource#80): Remove Dio from data_module
Browse files Browse the repository at this point in the history
  • Loading branch information
nivisi committed Jan 3, 2023
1 parent cf8464c commit 6f849c0
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions lib/injection/data_module.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import 'package:flutter_template/data/api/api_config.dart';
import 'package:flutter_template/data/interceptor/auth_interceptor.dart';
import 'package:flutter_template/injection/injector.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:injectable/injectable.dart';
import 'package:shared_preferences/shared_preferences.dart';
Expand All @@ -13,24 +8,6 @@ abstract class DataModule {
@preResolve
Future<SharedPreferences> get prefs => SharedPreferences.getInstance();

Dio getDio(ApiConfig apiConfig) {
final dio = Dio();
dio.httpClientAdapter = DefaultHttpClientAdapter();
dio.options.baseUrl = apiConfig.apiUrl;
dio.interceptors.add(
AuthInterceptor(
httpClient: injector(),
authPreferences: injector(),
userPreferences: injector(),
refreshTokenHttpClient: injector(),
onTokenExpired: () {
// TODO: Handle log out
},
),
);

return dio;
}
@singleton
FlutterSecureStorage get secureStorage => const FlutterSecureStorage(
aOptions: AndroidOptions(),
Expand Down

0 comments on commit 6f849c0

Please sign in to comment.