feat: Refactor sign-out method to use unified service call across repositories
This commit is contained in:
@@ -475,8 +475,7 @@ class StaffConnectorRepositoryImpl implements StaffConnectorRepository {
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await _service.auth.signOut();
|
||||
_service.clearCache();
|
||||
await _service.signOut();
|
||||
} catch (e) {
|
||||
throw Exception('Error signing out: ${e.toString()}');
|
||||
}
|
||||
|
||||
@@ -224,8 +224,19 @@ class DataConnectService with DataErrorHandler, SessionHandlerMixin {
|
||||
}
|
||||
}
|
||||
|
||||
/// Signs out the current user from Firebase Auth and clears all session data.
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await auth.signOut();
|
||||
_clearCache();
|
||||
} catch (e) {
|
||||
debugPrint('DataConnectService: Error signing out: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Clears Cached Repositories and Session data.
|
||||
void clearCache() {
|
||||
void _clearCache() {
|
||||
_reportsRepository = null;
|
||||
_shiftsRepository = null;
|
||||
_hubsRepository = null;
|
||||
|
||||
Reference in New Issue
Block a user