mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 10:08:00 -06:00
feat: Finish login switch account feature
This commit is contained in:
@@ -203,10 +203,9 @@ class AuthenticationCubit extends Cubit<AuthenticationState> {
|
||||
Future<void> logout() async {
|
||||
await _resetExternalState();
|
||||
final globalSettings = Hive.box<GlobalSettings>(HiveBoxes.globalSettings).getValue()!;
|
||||
globalSettings.currentLoggedInUser = null;
|
||||
await globalSettings.save();
|
||||
emit(const AuthenticationState.unauthenticated());
|
||||
globalSettings
|
||||
..currentLoggedInUser = null
|
||||
..save();
|
||||
}
|
||||
|
||||
Future<void> _resetExternalState() async {
|
||||
|
||||
@@ -71,11 +71,10 @@ class ManageAccountsPage extends StatelessWidget {
|
||||
],
|
||||
onSelected: (value) async {
|
||||
if (value == 0) {
|
||||
await context
|
||||
.read<AuthenticationCubit>()
|
||||
.removeAccount(globalSettings.currentLoggedInUser!);
|
||||
final currentUser = globalSettings.currentLoggedInUser!;
|
||||
await context.read<AuthenticationCubit>().logout();
|
||||
Navigator.of(context).pop();
|
||||
context.read<AuthenticationCubit>().logout();
|
||||
await context.read<AuthenticationCubit>().removeAccount(currentUser);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user