forked from eatvio/eatvio_app
34 lines
1023 B
Dart
34 lines
1023 B
Dart
import 'package:dio/dio.dart';
|
|
import 'package:eatvio_app/core/const.dart';
|
|
import 'package:eatvio_app/core/dio/phone_verify_error_interceptor.dart';
|
|
import 'package:eatvio_app/core/interceptors/token_interceptor.dart';
|
|
import 'package:get_it/get_it.dart';
|
|
|
|
/// Регистрация внешних зависимостей в системе внедрения зависимостей
|
|
class ExternalRegistrations {
|
|
static final sl = GetIt.instance;
|
|
|
|
/// Регистрация всех внешних зависимостей
|
|
static void registerAll() {
|
|
_registerDio();
|
|
}
|
|
|
|
/// Регистрация Dio HTTP клиента
|
|
static void _registerDio() {
|
|
sl.registerLazySingleton(
|
|
() => Dio(
|
|
BaseOptions(
|
|
baseUrl: baseUrl,
|
|
headers: {
|
|
'accept': 'application/json',
|
|
'content-type': 'application/json',
|
|
},
|
|
),
|
|
)..interceptors.addAll([
|
|
TokenInterceptor(),
|
|
PhoneVerifyErrorInterceptor(),
|
|
]),
|
|
);
|
|
}
|
|
}
|