Added Login with email model instead of json encode

This commit is contained in:
Mohammad Salameh
2024-03-10 10:20:06 +03:00
parent 5a7787b42d
commit 2c4543e83f
6 changed files with 57 additions and 30 deletions

View File

@ -1,6 +1,5 @@
import 'dart:convert';
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';
@ -20,13 +19,10 @@ class AuthenticationAPI {
}
static Future<Token> loginWithEmail(
{required String email, required String password}) async {
{required LoginWithEmailModel model}) async {
final response = await HTTPService().post(
path: ApiEndpoints.login,
body: jsonEncode({
"email": email,
"password": password,
}),
body: model.toJson(),
showServerMessage: false,
expectedResponseModel: (json) {
Token token = Token.fromJson(json['data']);