Files
syncrow-app/lib/services/api/authentication_api.dart
2024-03-10 10:20:06 +03:00

35 lines
1.2 KiB
Dart

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';
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 token = Token.fromJson(json);
return token;
});
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 token = Token.fromJson(json['data']);
return token;
});
debugPrint("response: $response");
return response;
}
}