account working
This commit is contained in:
@@ -95,6 +95,8 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
).execute();
|
||||
final GetUserByIdUser? user = response.data.user;
|
||||
|
||||
GetStaffByUserIdStaffs? staffRecord;
|
||||
|
||||
if (mode == AuthMode.signup) {
|
||||
if (user == null) {
|
||||
await dataConnect
|
||||
@@ -140,6 +142,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
'Your account is not registered yet. Please register first.',
|
||||
);
|
||||
}
|
||||
staffRecord = staffResponse.data.staffs.first;
|
||||
}
|
||||
|
||||
final String email = user?.email ?? '';
|
||||
@@ -152,8 +155,21 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
phone: firebaseUser.phoneNumber,
|
||||
role: user?.role.stringValue ?? 'USER',
|
||||
);
|
||||
final domain.Staff? domainStaff = staffRecord == null
|
||||
? null
|
||||
: domain.Staff(
|
||||
id: staffRecord.id,
|
||||
authProviderId: staffRecord.userId,
|
||||
name: staffRecord.fullName,
|
||||
email: staffRecord.email ?? '',
|
||||
phone: staffRecord.phone,
|
||||
status: domain.StaffStatus.completedProfile,
|
||||
address: staffRecord.addres,
|
||||
avatar: staffRecord.photoUrl,
|
||||
livePhoto: null,
|
||||
);
|
||||
StaffSessionStore.instance.setSession(
|
||||
StaffSession(user: domainUser, staff: null),
|
||||
StaffSession(user: domainUser, staff: domainStaff),
|
||||
);
|
||||
return domainUser;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user