User can sign out of his account
This commit is contained in:
@ -42,9 +42,14 @@ class CurrentAuthState extends _$CurrentAuthState {
|
||||
/// Logs out, deletes the saved token and profile info from storage, and invalidates
|
||||
/// the state.
|
||||
Future<void> logout() async {
|
||||
final prefs = ref.read(prefsProvider).requireValue;
|
||||
|
||||
final secureStorage = ref.read(secureStorageProvider).requireValue;
|
||||
await secureStorage.removeToken();
|
||||
|
||||
prefs.clearServerConfig();
|
||||
prefs.clearAuthInfo();
|
||||
|
||||
ref
|
||||
// Invalidate the state so the auth state will be updated to authenticated.
|
||||
.invalidateSelf();
|
||||
|
Reference in New Issue
Block a user