diff --git a/lib/redux/auth/auth_middleware.dart b/lib/redux/auth/auth_middleware.dart index e5df9e513..6e99de66d 100644 --- a/lib/redux/auth/auth_middleware.dart +++ b/lib/redux/auth/auth_middleware.dart @@ -294,8 +294,8 @@ Middleware _deleteCompany(AuthRepository repository) { password: action.password, companyId: state.company.id) .then((dynamic value) { - action.completer.complete(null); store.dispatch(DeleteCompanySuccess()); + action.completer.complete(null); }).catchError((Object error) { store.dispatch(DeleteCompanyFailure(error)); }); diff --git a/lib/redux/company/company_actions.dart b/lib/redux/company/company_actions.dart index 76a6d1642..b465a197e 100644 --- a/lib/redux/company/company_actions.dart +++ b/lib/redux/company/company_actions.dart @@ -54,9 +54,7 @@ class DeleteCompanyRequest implements StartSaving { final String password; } -class DeleteCompanySuccess implements StopSaving, PersistData { - DeleteCompanySuccess(); -} +class DeleteCompanySuccess implements StopSaving, PersistData {} class DeleteCompanyFailure implements StopSaving { DeleteCompanyFailure(this.error); diff --git a/lib/redux/company/company_reducer.dart b/lib/redux/company/company_reducer.dart index 226fc8d53..657aa64da 100644 --- a/lib/redux/company/company_reducer.dart +++ b/lib/redux/company/company_reducer.dart @@ -32,6 +32,8 @@ import 'package:invoiceninja_flutter/redux/group/group_reducer.dart'; UserCompanyState companyReducer(UserCompanyState state, dynamic action) { if (action is RefreshData && action.loadCompanies) { return UserCompanyState(); + } else if (action is DeleteCompanySuccess) { + return UserCompanyState(); } return state.rebuild((b) => b