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,3 +1,5 @@
import 'package:syncrow_app/features/auth/model/token.dart';
class UserModel {
final String? id;
final String? email;
@ -43,10 +45,12 @@ class UserModel {
}
//from token
factory UserModel.fromToken(Map<String, dynamic> json) {
factory UserModel.fromToken(Token token) {
Map<String, dynamic> tempJson = token.decodeToken();
return UserModel(
id: json['userId'].toString(),
email: json['email'],
id: tempJson['userId'].toString(),
email: tempJson['email'],
name: null,
photoUrl: null,
phoneNumber: null,