getting spaces and rooms from api {null checks}

This commit is contained in:
Mohammad Salameh
2024-03-13 13:52:22 +03:00
parent 0f3cc453ce
commit 024f15728b
26 changed files with 390 additions and 266 deletions

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:syncrow_app/features/auth/model/login_with_email_model.dart';
import 'package:syncrow_app/features/auth/model/token.dart';
import 'package:syncrow_app/features/auth/model/verify_code.dart';
@ -11,21 +10,22 @@ class AuthenticationAPI {
path: ApiEndpoints.verifyOtp,
body: data.toJson(),
showServerMessage: false,
expectedResponseModel: (json) {
Token token = Token.fromJson(json);
return token;
});
expectedResponseModel: (json) => Token.fromJson(json));
return response;
}
static Future<Token> loginWithEmail(
{required LoginWithEmailModel model}) async {
final response = await HTTPService().post(
path: ApiEndpoints.login,
body: model.toJson(),
showServerMessage: false,
expectedResponseModel: (json) => Token.fromJson(json['data']));
debugPrint("response: $response");
return response;
try {
final response = await HTTPService().post(
path: ApiEndpoints.login,
body: model.toJson(),
showServerMessage: false,
expectedResponseModel: (json) => Token.fromJson(json['data']));
// debugPrint("response: $response");
return response;
} catch (e) {
rethrow;
}
}
}