Настройки, авторизация

This commit is contained in:
Халимов Рустам
2026-05-14 12:06:34 +03:00
parent e8161d23d4
commit ccffc5a53c
41 changed files with 2556 additions and 1375 deletions
@@ -15,6 +15,7 @@ class SettingsRemoteDataSourceImpl implements SettingsRemoteDataSource {
@override
Future<Result<ServerConfig>> getServerConfig() async {
try {
// Backend ожидает /api/config
final response = await _dio.get('/api/config');
if (response.statusCode == 200) {
final config = ServerConfig.fromJson(response.data as Map<String, dynamic>);
@@ -23,8 +24,10 @@ class SettingsRemoteDataSourceImpl implements SettingsRemoteDataSource {
return Result.failure(AppError.server(statusCode: 500, message: 'Failed to load config'));
} on DioException catch (e) {
return Result.failure(AppError.network(message: e.message));
} on TypeError catch (e) {
return Result.failure(AppError.unknown(message: 'Data parsing error: ${e.toString()}'));
} catch (e) {
return Result.failure(const AppError.unknown(message: 'Unknown error'));
return Result.failure(AppError.unknown(message: e.toString()));
}
}
}