mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Refactor schedule components and update imports for garage door and w… (#271)
…ater heater modules <!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Jira Ticket [SP-1620](https://syncrow.atlassian.net/browse/SP-1620) ## Description <!--- Describe your changes in detail --> Refactor schedule components and make this fetcher as a reusable and fix bugs related to it ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ x] ✨ New feature (non-breaking change which adds functionality) - [x] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore [SP-1620]: https://syncrow.atlassian.net/browse/SP-1620?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
|
||||
@ -386,4 +387,34 @@ class DevicesManagementApi {
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<bool> postSchedule({
|
||||
required String category,
|
||||
required String deviceId,
|
||||
required String time,
|
||||
required String code,
|
||||
required bool value,
|
||||
required List<String> days,
|
||||
}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.saveSchedule.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
body: jsonEncode(
|
||||
{
|
||||
'category': category,
|
||||
'time': time,
|
||||
'function': {
|
||||
'code': code,
|
||||
'value': value,
|
||||
},
|
||||
'days': days
|
||||
},
|
||||
),
|
||||
expectedResponseModel: (json) {
|
||||
return json['success'] ?? false;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user