Skip to content

Commit

Permalink
Default to last selected company when re-opening app or website #311
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Aug 12, 2021
1 parent 60f5e17 commit bc0c89a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/redux/app/app_middleware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ Middleware<AppState> _createDataRefreshed() {
if (response.userCompanies.length == 1) {
final userCompany = response.userCompanies.first;
store.dispatch(LoadCompanySuccess(userCompany));
store.dispatch(PersistData());
} else {
for (int i = 0;
i < min(response.userCompanies.length, kMaxNumberOfCompanies);
Expand All @@ -498,14 +497,15 @@ Middleware<AppState> _createDataRefreshed() {
store.dispatch(
SelectCompany(companyIndex: i, clearSelection: loadedStaticData));
store.dispatch(LoadCompanySuccess(userCompany));
store.dispatch(PersistData());
}
}
} catch (error) {
action.completer?.completeError(error);
rethrow;
}

store.dispatch(UserLoginSuccess());

if (action.completer != null) {
action.completer.complete(null);
}
Expand Down

0 comments on commit bc0c89a

Please sign in to comment.