diff --git a/b0esche_cloud/lib/blocs/organization/organization_bloc.dart b/b0esche_cloud/lib/blocs/organization/organization_bloc.dart index 2b565e1..8829b1b 100644 --- a/b0esche_cloud/lib/blocs/organization/organization_bloc.dart +++ b/b0esche_cloud/lib/blocs/organization/organization_bloc.dart @@ -97,7 +97,9 @@ class OrganizationBloc extends Bloc { CreateOrganization event, Emitter emit, ) async { - print('[DEBUG-ORG-CREATION] CreateOrganization event received with name: "${event.name}"'); + print( + '[DEBUG-ORG-CREATION] CreateOrganization event received with name: "${event.name}"', + ); final name = event.name.trim(); if (name.isEmpty) { print('[DEBUG-ORG-CREATION] Name is empty after trim'); @@ -146,10 +148,14 @@ class OrganizationBloc extends Bloc { ), ); - print('[DEBUG-ORG-CREATION] About to call orgApi.createOrganization with name: "$name"'); + print( + '[DEBUG-ORG-CREATION] About to call orgApi.createOrganization with name: "$name"', + ); try { final newOrg = await orgApi.createOrganization(name); - print('[DEBUG-ORG-CREATION] API returned successfully: ${newOrg.id} - ${newOrg.name}'); + print( + '[DEBUG-ORG-CREATION] API returned successfully: ${newOrg.id} - ${newOrg.name}', + ); final updatedOrgs = [...existingOrgs, newOrg]; emit(OrganizationLoaded(organizations: updatedOrgs, selectedOrg: newOrg)); // Reset blocs and load permissions for new org diff --git a/b0esche_cloud/lib/services/api_client.dart b/b0esche_cloud/lib/services/api_client.dart index 78e0cd7..ea721b4 100644 --- a/b0esche_cloud/lib/services/api_client.dart +++ b/b0esche_cloud/lib/services/api_client.dart @@ -13,7 +13,9 @@ class ApiClient { BaseOptions( baseUrl: baseUrl, connectTimeout: const Duration(seconds: 10), - receiveTimeout: const Duration(seconds: 60), // Increased for file uploads and org operations + receiveTimeout: const Duration( + seconds: 60, + ), // Increased for file uploads and org operations ), ); @@ -72,13 +74,19 @@ class ApiClient { dynamic data, required T Function(dynamic data) fromJson, }) async { - print('[DEBUG-API-CLIENT] POST request starting - path: $path, data: $data'); + print( + '[DEBUG-API-CLIENT] POST request starting - path: $path, data: $data', + ); try { final response = await _dio.post(path, data: data); - print('[DEBUG-API-CLIENT] POST response received - status: ${response.statusCode}, data: ${response.data}'); + print( + '[DEBUG-API-CLIENT] POST response received - status: ${response.statusCode}, data: ${response.data}', + ); return fromJson(response.data); } on DioException catch (e) { - print('[DEBUG-API-CLIENT] POST request failed - type: ${e.type}, message: ${e.message}, status: ${e.response?.statusCode}'); + print( + '[DEBUG-API-CLIENT] POST request failed - type: ${e.type}, message: ${e.message}, status: ${e.response?.statusCode}', + ); throw _handleError(e); } } diff --git a/b0esche_cloud/lib/services/org_api.dart b/b0esche_cloud/lib/services/org_api.dart index 534a7f0..1521b1a 100644 --- a/b0esche_cloud/lib/services/org_api.dart +++ b/b0esche_cloud/lib/services/org_api.dart @@ -15,16 +15,20 @@ class OrgApi { } Future createOrganization(String name) async { - print('[DEBUG-ORG-CREATION] OrgApi.createOrganization called with name: "$name"'); + print( + '[DEBUG-ORG-CREATION] OrgApi.createOrganization called with name: "$name"', + ); developer.log('POST /orgs with payload: {"name": "$name"}', name: 'OrgApi'); - + try { final result = await _apiClient.post( '/orgs', data: {'name': name}, fromJson: (data) => Organization.fromJson(data), ); - print('[DEBUG-ORG-CREATION] OrgApi.createOrganization returned: ${result.id}'); + print( + '[DEBUG-ORG-CREATION] OrgApi.createOrganization returned: ${result.id}', + ); return result; } catch (e) { print('[DEBUG-ORG-CREATION] OrgApi.createOrganization error: $e');