Bug when deleting company

This commit is contained in:
Hillel Coren 2020-06-04 21:17:25 +03:00
parent 979457eeef
commit e46ab5e0fd
3 changed files with 4 additions and 4 deletions

View File

@ -294,8 +294,8 @@ Middleware<AppState> _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));
});

View File

@ -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);

View File

@ -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