Bug: should logout when deleting last company
This commit is contained in:
parent
5a30a49068
commit
89f37c15fc
|
|
@ -62,12 +62,16 @@ class AccountManagementVM {
|
||||||
children: <Widget>[LoadingDialog()],
|
children: <Widget>[LoadingDialog()],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
final companyLength = state.companies.length;
|
||||||
final deleteCompleter = Completer<Null>()
|
final deleteCompleter = Completer<Null>()
|
||||||
..future.then((value) {
|
..future.then((value) {
|
||||||
store.dispatch(SelectCompany(companyIndex: 0));
|
if (companyLength == 1) {
|
||||||
final refreshCompleter = Completer<Null>()
|
print('## No more companies');
|
||||||
..future.then((value) {
|
store.dispatch(UserLogout(context));
|
||||||
if (store.state.companies.isNotEmpty) {
|
} else {
|
||||||
|
store.dispatch(SelectCompany(companyIndex: 0));
|
||||||
|
final refreshCompleter = Completer<Null>()
|
||||||
|
..future.then((value) {
|
||||||
store.dispatch(SelectCompany(companyIndex: 0));
|
store.dispatch(SelectCompany(companyIndex: 0));
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
ViewDashboard(navigator: Navigator.of(context)));
|
ViewDashboard(navigator: Navigator.of(context)));
|
||||||
|
|
@ -75,13 +79,10 @@ class AccountManagementVM {
|
||||||
if (Navigator.of(context).canPop()) {
|
if (Navigator.of(context).canPop()) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
print('## No companies');
|
store.dispatch(
|
||||||
store.dispatch(UserLogout(context));
|
RefreshData(clearData: true, completer: refreshCompleter));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
store.dispatch(
|
|
||||||
RefreshData(clearData: true, completer: refreshCompleter));
|
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue