refactor: update AttireCubit dependency injection to non-lazy and ensure uploadPhoto returns the updated attire item status.
This commit is contained in:
@@ -33,7 +33,7 @@ class StaffAttireModule extends Module {
|
||||
i.addLazySingleton(UploadAttirePhotoUseCase.new);
|
||||
|
||||
// BLoC
|
||||
i.addLazySingleton(AttireCubit.new);
|
||||
i.add(AttireCubit.new);
|
||||
i.add(AttireCaptureCubit.new);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@ class AttireRepositoryImpl implements AttireRepository {
|
||||
|
||||
@override
|
||||
Future<AttireItem> uploadPhoto(String itemId, String filePath) async {
|
||||
// 6. Return updated AttireItem by re-fetching to get the PENDING/SUCCESS status
|
||||
final List<AttireItem> finalOptions = await _connector.getAttireOptions();
|
||||
return finalOptions.firstWhere((AttireItem e) => e.id == itemId);
|
||||
|
||||
// 1. Upload file to Core API
|
||||
final FileUploadService uploadService = Modular.get<FileUploadService>();
|
||||
final FileUploadResponse uploadRes = await uploadService.uploadFile(
|
||||
@@ -108,8 +104,8 @@ class AttireRepositoryImpl implements AttireRepository {
|
||||
);
|
||||
|
||||
// 6. Return updated AttireItem by re-fetching to get the PENDING/SUCCESS status
|
||||
// final List<AttireItem> finalOptions = await _connector.getAttireOptions();
|
||||
// return finalOptions.firstWhere((AttireItem e) => e.id == itemId);
|
||||
final List<AttireItem> finalOptions = await _connector.getAttireOptions();
|
||||
return finalOptions.firstWhere((AttireItem e) => e.id == itemId);
|
||||
}
|
||||
|
||||
AttireVerificationStatus _mapToAttireStatus(VerificationStatus status) {
|
||||
|
||||
Reference in New Issue
Block a user