mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-11 15:47:35 +00:00
36 lines
1.3 KiB
Dart
36 lines
1.3 KiB
Dart
import 'package:syncrow_app/features/auth/model/login_with_email_model.dart';
|
|
import 'package:syncrow_app/features/auth/model/signup_model.dart';
|
|
import 'package:syncrow_app/features/auth/model/token.dart';
|
|
import 'package:syncrow_app/features/auth/model/verify_code.dart';
|
|
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
|
import 'package:syncrow_app/services/api/http_service.dart';
|
|
|
|
class AuthenticationAPI {
|
|
static Future<Token> verifyPassCode(VerifyPassCode data) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.verifyOtp,
|
|
body: data.toJson(),
|
|
showServerMessage: false,
|
|
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']));
|
|
return response;
|
|
}
|
|
|
|
static Future<Token> signUp({required SignUpModel model}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.signUp,
|
|
body: model.toJson(),
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) => Token.fromJson(json['data']));
|
|
return response;
|
|
}
|
|
}
|