Настройки, авторизация
This commit is contained in:
+4
-1
@@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user