mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 21:04:55 +00:00
getting spaces and rooms from api {null checks}
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user