Changes for is_large

This commit is contained in:
Hillel Coren 2021-08-17 18:23:26 +03:00
parent 4aab186a6d
commit 590d6da64e
2 changed files with 18 additions and 10 deletions

View File

@ -143,10 +143,6 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
final store = widget.store;
final state = store.state;
if (!state.isSelfHosted) {
return;
}
if (!state.authState.isAuthenticated) {
return;
}

View File

@ -235,11 +235,19 @@ Middleware<AppState> _createLoadState(
AppBuilder.of(action.context).rebuild();
store.dispatch(LoadStateSuccess(appState));
if (store.state.company.isLarge) {
store.dispatch(LoadClients(
completer: Completer<Null>()
..future.catchError((Object error) {
store.dispatch(UserLogout());
})));
} else {
store.dispatch(RefreshData(
completer: Completer<Null>()
..future.catchError((Object error) {
store.dispatch(UserLogout());
})));
}
if (uiState.currentRoute != LoginScreen.route &&
uiState.currentRoute.isNotEmpty) {
@ -307,7 +315,11 @@ Middleware<AppState> _createLoadState(
print('## ERROR (app_middleware - refresh): $error');
store.dispatch(UserLogout());
});
if (store.state.company.isLarge) {
store.dispatch(LoadClients(completer: completer));
} else {
store.dispatch(RefreshData(completer: completer, clearData: true));
}
} else {
store.dispatch(UserLogout());
}