mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 06:07:57 -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 {
|
Future<void> logout() async {
|
||||||
await _resetExternalState();
|
await _resetExternalState();
|
||||||
final globalSettings = Hive.box<GlobalSettings>(HiveBoxes.globalSettings).getValue()!;
|
final globalSettings = Hive.box<GlobalSettings>(HiveBoxes.globalSettings).getValue()!;
|
||||||
|
globalSettings.currentLoggedInUser = null;
|
||||||
|
await globalSettings.save();
|
||||||
emit(const AuthenticationState.unauthenticated());
|
emit(const AuthenticationState.unauthenticated());
|
||||||
globalSettings
|
|
||||||
..currentLoggedInUser = null
|
|
||||||
..save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _resetExternalState() async {
|
Future<void> _resetExternalState() async {
|
||||||
|
|||||||
@@ -71,11 +71,10 @@ class ManageAccountsPage extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
onSelected: (value) async {
|
onSelected: (value) async {
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
await context
|
final currentUser = globalSettings.currentLoggedInUser!;
|
||||||
.read<AuthenticationCubit>()
|
await context.read<AuthenticationCubit>().logout();
|
||||||
.removeAccount(globalSettings.currentLoggedInUser!);
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.read<AuthenticationCubit>().logout();
|
await context.read<AuthenticationCubit>().removeAccount(currentUser);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user