mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-11 15:47:35 +00:00
36 lines
1.2 KiB
Dart
36 lines
1.2 KiB
Dart
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
|
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
|
import 'package:syncrow_app/services/api/http_service.dart';
|
|
|
|
class SpacesAPI {
|
|
// static Future<Token> loginWithEmail(
|
|
// {required LoginWithEmailModel model}) async {
|
|
// final response = await HTTPService().post(
|
|
// path: ApiEndpoints.login,
|
|
// body: model.toJson(),
|
|
// showServerMessage: false,
|
|
// expectedResponseModel: (json) {
|
|
// Token token = Token.fromJson(json['data']);
|
|
// return token;
|
|
// });
|
|
// debugPrint("response: $response");
|
|
// return response;
|
|
// }
|
|
|
|
static Future<List<SpaceModel>> getSpaces() async {
|
|
final response = await HTTPService().get(
|
|
path: "${ApiEndpoints.spaces}/${AuthCubit.user!.uuid}",
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
List<SpaceModel> spaces = [];
|
|
for (var space in json) {
|
|
spaces.add(SpaceModel.fromJson(space));
|
|
}
|
|
return spaces;
|
|
},
|
|
);
|
|
return response;
|
|
}
|
|
}
|