fix: Correctly map staff ID from session.staff.id and assign StaffSession.ownerId from s.ownerId.
This commit is contained in:
@@ -78,14 +78,14 @@ class DataConnectService with DataErrorHandler, SessionHandlerMixin {
|
||||
|
||||
/// Helper to get the current staff ID from the session.
|
||||
Future<String> getStaffId() async {
|
||||
String? staffId = dc.StaffSessionStore.instance.session?.ownerId;
|
||||
String? staffId = dc.StaffSessionStore.instance.session?.staff?.id;
|
||||
|
||||
if (staffId == null || staffId.isEmpty) {
|
||||
// Attempt to recover session if user is signed in
|
||||
final user = auth.currentUser;
|
||||
if (user != null) {
|
||||
await _loadSession(user.uid);
|
||||
staffId = dc.StaffSessionStore.instance.session?.ownerId;
|
||||
staffId = dc.StaffSessionStore.instance.session?.staff?.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class DataConnectService with DataErrorHandler, SessionHandlerMixin {
|
||||
final s = response.data.staffs.first;
|
||||
dc.StaffSessionStore.instance.setSession(
|
||||
dc.StaffSession(
|
||||
ownerId: s.id,
|
||||
ownerId: s.ownerId,
|
||||
staff: domain.Staff(
|
||||
id: s.id,
|
||||
authProviderId: s.userId,
|
||||
|
||||
Reference in New Issue
Block a user