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 store = widget.store;
final state = store.state; final state = store.state;
if (!state.isSelfHosted) {
return;
}
if (!state.authState.isAuthenticated) { if (!state.authState.isAuthenticated) {
return; return;
} }

View File

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