fix: Correctly map staff ID from session.staff.id and assign StaffSession.ownerId from s.ownerId.

This commit is contained in:
Achintha Isuru
2026-02-22 11:26:30 -05:00
parent 2d1e6a6acc
commit 6e43888187
2 changed files with 3 additions and 4 deletions

View File

@@ -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,

View File

@@ -117,7 +117,6 @@ class _ShiftsPageState extends State<ShiftsPage> {
// Note: Calendar logic moved to MyShiftsTab
return Scaffold(
backgroundColor: UiColors.background,
body: Column(
children: [
// Header (Blue)