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.
|
/// Helper to get the current staff ID from the session.
|
||||||
Future<String> getStaffId() async {
|
Future<String> getStaffId() async {
|
||||||
String? staffId = dc.StaffSessionStore.instance.session?.ownerId;
|
String? staffId = dc.StaffSessionStore.instance.session?.staff?.id;
|
||||||
|
|
||||||
if (staffId == null || staffId.isEmpty) {
|
if (staffId == null || staffId.isEmpty) {
|
||||||
// Attempt to recover session if user is signed in
|
// Attempt to recover session if user is signed in
|
||||||
final user = auth.currentUser;
|
final user = auth.currentUser;
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
await _loadSession(user.uid);
|
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;
|
final s = response.data.staffs.first;
|
||||||
dc.StaffSessionStore.instance.setSession(
|
dc.StaffSessionStore.instance.setSession(
|
||||||
dc.StaffSession(
|
dc.StaffSession(
|
||||||
ownerId: s.id,
|
ownerId: s.ownerId,
|
||||||
staff: domain.Staff(
|
staff: domain.Staff(
|
||||||
id: s.id,
|
id: s.id,
|
||||||
authProviderId: s.userId,
|
authProviderId: s.userId,
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
// Note: Calendar logic moved to MyShiftsTab
|
// Note: Calendar logic moved to MyShiftsTab
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: UiColors.background,
|
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
// Header (Blue)
|
// Header (Blue)
|
||||||
|
|||||||
Reference in New Issue
Block a user