Skip to content

Commit

Permalink
fix(logout): clear data immediarly on guest logout
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharlock10 committed May 11, 2022
1 parent 936adbb commit 53656a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/providers/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ class _AuthNotifier extends ChangeNotifier {
// 3) Notify backend about logout
// 4) remove user, player, token from provider

// clear values from the database and utilities
await utilities.Database.clear();

utilities.api.options.headers["authorization"] = null;
utilities.Global.isAuthenticated = false;

try {
await GoogleSignIn().signOut();
} catch (_) {
Expand All @@ -192,12 +198,6 @@ class _AuthNotifier extends ChangeNotifier {
}
}

// clear values from the database and utilities
await utilities.Database.clear();

utilities.api.options.headers["authorization"] = null;
utilities.Global.isAuthenticated = false;

// clear data from all providers
clearData();
ref.read(champions_provider.champions).clearData();
Expand Down

0 comments on commit 53656a4

Please sign in to comment.