Code cleanup

This commit is contained in:
Hillel Coren 2023-09-07 16:33:56 +03:00
parent 593c85913c
commit 9946c5b41e
1 changed files with 10 additions and 11 deletions

View File

@ -25,25 +25,24 @@ Middleware<AppState> _createViewDashboard() {
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
final action = dynamicAction as ViewDashboard;
if (!store.state.userCompany.canViewDashboard) {
store.dispatch(ViewClientList());
next(action);
return;
}
checkForChanges(
store: store,
force: action.force,
callback: () {
if (store.state.isStale) {
store.dispatch(RefreshData());
}
if (!store.state.userCompany.canViewDashboard) {
store.dispatch(ViewClientList());
} else {
if (store.state.isStale) {
store.dispatch(RefreshData());
}
store.dispatch(UpdateCurrentRoute(DashboardScreenBuilder.route));
store.dispatch(UpdateCurrentRoute(DashboardScreenBuilder.route));
}
next(action);
if (store.state.prefState.isMobile) {
if (store.state.prefState.isMobile &&
store.state.userCompany.canViewDashboard) {
navigatorKey.currentState.pushNamedAndRemoveUntil(
DashboardScreenBuilder.route, (Route<dynamic> route) => false);
}