결재 API 계약 보완 및 테스트 정리
This commit is contained in:
@@ -7,6 +7,11 @@ import 'core/network/api_client.dart';
|
||||
import 'core/network/api_error.dart';
|
||||
import 'core/network/interceptors/auth_interceptor.dart';
|
||||
import 'core/services/token_storage.dart';
|
||||
import 'features/auth/application/auth_service.dart';
|
||||
import 'features/auth/data/repositories/auth_repository_remote.dart';
|
||||
import 'features/auth/domain/repositories/auth_repository.dart';
|
||||
import 'features/dashboard/data/repositories/dashboard_repository_remote.dart';
|
||||
import 'features/dashboard/domain/repositories/dashboard_repository.dart';
|
||||
import 'features/inventory/lookups/data/repositories/inventory_lookup_repository_remote.dart';
|
||||
import 'features/inventory/lookups/domain/repositories/inventory_lookup_repository.dart';
|
||||
import 'features/inventory/transactions/data/repositories/stock_transaction_repository_remote.dart';
|
||||
@@ -69,7 +74,16 @@ Future<void> initInjection({
|
||||
sl.registerLazySingleton<TokenStorage>(() => tokenStorage);
|
||||
sl.registerLazySingleton<ApiErrorMapper>(ApiErrorMapper.new);
|
||||
|
||||
final authInterceptor = AuthInterceptor(tokenStorage: tokenStorage, dio: dio);
|
||||
final authInterceptor = AuthInterceptor(
|
||||
tokenStorage: tokenStorage,
|
||||
dio: dio,
|
||||
onRefresh: () {
|
||||
if (!sl.isRegistered<AuthService>()) {
|
||||
return Future<TokenPair?>.value(null);
|
||||
}
|
||||
return sl<AuthService>().refreshForInterceptor();
|
||||
},
|
||||
);
|
||||
dio.interceptors.add(authInterceptor);
|
||||
|
||||
// 개발용 로거는 필요 시 추가 (pretty_dio_logger 등)
|
||||
@@ -80,6 +94,21 @@ Future<void> initInjection({
|
||||
() => ApiClient(dio: dio, errorMapper: sl<ApiErrorMapper>()),
|
||||
);
|
||||
|
||||
// 인증 서비스 등록
|
||||
sl.registerLazySingleton<AuthRepository>(
|
||||
() => AuthRepositoryRemote(apiClient: sl<ApiClient>()),
|
||||
);
|
||||
sl.registerLazySingleton<AuthService>(
|
||||
() => AuthService(
|
||||
repository: sl<AuthRepository>(),
|
||||
tokenStorage: sl<TokenStorage>(),
|
||||
),
|
||||
);
|
||||
|
||||
sl.registerLazySingleton<DashboardRepository>(
|
||||
() => DashboardRepositoryRemote(apiClient: sl<ApiClient>()),
|
||||
);
|
||||
|
||||
// 리포지토리 등록 (예: 벤더)
|
||||
sl.registerLazySingleton<VendorRepository>(
|
||||
() => VendorRepositoryRemote(apiClient: sl<ApiClient>()),
|
||||
|
||||
Reference in New Issue
Block a user