SP-1723-FE-Integrate-Charts-with-API-s-for-AQI-sensor.

This commit is contained in:
Faris Armoush
2025-06-16 13:12:57 +03:00
parent 4d9145a953
commit 96f463229c
6 changed files with 57 additions and 70 deletions

View File

@ -3,14 +3,20 @@ import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart';
class HomeApi {
Future fetchUserInfo(userId) async {
final response = await HTTPService().get(
path: ApiEndpoints.getUser.replaceAll('{userUuid}', userId!),
Future<UserModel?> fetchUserInfo(String userId) async {
try {
final response = await HTTPService().get(
path: ApiEndpoints.getUser.replaceAll('{userUuid}', userId),
showServerMessage: true,
expectedResponseModel: (json) {
return UserModel.fromJson(json);
});
return response;
final user = UserModel.fromJson(json as Map<String, dynamic>);
return user;
},
);
return response;
} catch (e) {
return null;
}
}
Future fetchTerms() async {