feat: Refactor sign-out method to use unified service call across repositories

This commit is contained in:
Achintha Isuru
2026-03-02 16:04:20 -05:00
parent 8497709356
commit e8b768b978
5 changed files with 22 additions and 17 deletions

View File

@@ -338,8 +338,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
@override
Future<void> signOut() async {
try {
await _service.auth.signOut();
_service.clearCache();
await _service.signOut();
} catch (e) {
throw Exception('Error signing out: ${e.toString()}');
}
@@ -371,9 +370,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
if (requireBusinessRole &&
user.userRole != 'BUSINESS' &&
user.userRole != 'BOTH') {
await _service.auth.signOut();
dc.ClientSessionStore.instance.clear();
_service.clearCache();
await _service.signOut();
throw UnauthorizedAppException(
technicalMessage:
'User role is ${user.userRole}, expected BUSINESS or BOTH',

View File

@@ -15,7 +15,7 @@ class SettingsRepositoryImpl implements SettingsRepositoryInterface {
@override
Future<void> signOut() async {
return _service.run(() async {
await _service.auth.signOut();
await _service.signOut();
});
}
}