Skip to content

Commit

Permalink
fix: do not allow duplicate account (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon authored Oct 5, 2024
1 parent ca9ec3d commit 82a3944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/provider/accounts_notifier_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ class AccountsNotifier extends _$AccountsNotifier {
}

Future<void> login(Account account, String token) async {
if (state.contains(account)) {
return;
}
await ref.read(tokensNotifierProvider.notifier).add(account, token);
state = [...state, account];
if (state.contains(account)) return;
state = {...state, account}.toList();
await _save();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/provider/accounts_notifier_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82a3944

Please sign in to comment.