mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 21:04:55 +00:00
35 lines
1.2 KiB
Dart
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;
|
|
}
|
|
}
|