changed endpoint for get visitor password and access control

This commit is contained in:
hannathkadher
2025-02-16 23:32:46 +04:00
parent e1609309cf
commit 581dcf7016
9 changed files with 84 additions and 43 deletions

View File

@ -6,10 +6,10 @@ import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart';
class AccessMangApi {
Future<List<PasswordModel>> fetchVisitorPassword() async {
Future<List<PasswordModel>> fetchVisitorPassword(String projectId) async {
try {
final response = await HTTPService().get(
path: ApiEndpoints.visitorPassword,
path: ApiEndpoints.visitorPassword.replaceAll('{projectId}', projectId),
showServerMessage: true,
expectedResponseModel: (json) {
List<dynamic> jsonData = json;
@ -25,10 +25,10 @@ class AccessMangApi {
}
}
Future fetchDevices() async {
Future fetchDevices(String projectId) async {
try {
final response = await HTTPService().get(
path: ApiEndpoints.getDevices,
path: ApiEndpoints.getDevices.replaceAll('{projectId}', projectId),
showServerMessage: true,
expectedResponseModel: (json) {
List<dynamic> jsonData = json;
@ -86,7 +86,8 @@ class AccessMangApi {
"invalidTime": invalidTime,
};
if (scheduleList != null) {
body["scheduleList"] = scheduleList.map((schedule) => schedule.toJson()).toList();
body["scheduleList"] =
scheduleList.map((schedule) => schedule.toJson()).toList();
}
final response = await HTTPService().post(
path: ApiEndpoints.sendOnlineMultipleTime,
@ -105,7 +106,11 @@ class AccessMangApi {
{String? email, String? passwordName, List<String>? devicesUuid}) async {
final response = await HTTPService().post(
path: ApiEndpoints.sendOffLineOneTime,
body: jsonEncode({"email": email, "passwordName": passwordName, "devicesUuid": devicesUuid}),
body: jsonEncode({
"email": email,
"passwordName": passwordName,
"devicesUuid": devicesUuid
}),
showServerMessage: true,
expectedResponseModel: (json) {
return json;

View File

@ -20,7 +20,7 @@ class DevicesManagementApi {
.replaceAll('{spaceUuid}', spaceId)
.replaceAll('{communityUuid}', communityId)
.replaceAll('{projectId}', projectId)
: ApiEndpoints.getAllDevices,
: ApiEndpoints.getAllDevices.replaceAll('{projectId}', projectId),
showServerMessage: true,
expectedResponseModel: (json) {
List<dynamic> jsonData =