mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
change the validation from static code to backend
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/routines/bloc/automation_scene_trigger_bloc/automation_status_update.dart';
|
||||
import 'package:syncrow_web/pages/routines/models/create_scene_and_autoamtion/create_automation_model.dart';
|
||||
@ -5,6 +6,7 @@ import 'package:syncrow_web/pages/routines/models/create_scene_and_autoamtion/cr
|
||||
import 'package:syncrow_web/pages/routines/models/icon_model.dart';
|
||||
import 'package:syncrow_web/pages/routines/models/routine_details_model.dart';
|
||||
import 'package:syncrow_web/pages/routines/models/routine_model.dart';
|
||||
import 'package:syncrow_web/services/api/api_exception.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
import 'package:syncrow_web/utils/constants/api_const.dart';
|
||||
|
||||
@ -26,9 +28,10 @@ class SceneApi {
|
||||
);
|
||||
debugPrint('create scene response: $response');
|
||||
return response;
|
||||
} catch (e) {
|
||||
debugPrint(e.toString());
|
||||
rethrow;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,9 +51,10 @@ class SceneApi {
|
||||
);
|
||||
debugPrint('create automation response: $response');
|
||||
return response;
|
||||
} catch (e) {
|
||||
debugPrint(e.toString());
|
||||
rethrow;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,8 +169,10 @@ class SceneApi {
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,8 +191,10 @@ class SceneApi {
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,8 +225,10 @@ class SceneApi {
|
||||
expectedResponseModel: (json) => json['statusCode'] == 200,
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,8 +246,10 @@ class SceneApi {
|
||||
expectedResponseModel: (json) => json['statusCode'] == 200,
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user