Code cleanup
This commit is contained in:
parent
593c85913c
commit
9946c5b41e
|
|
@ -25,25 +25,24 @@ Middleware<AppState> _createViewDashboard() {
|
||||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||||
final action = dynamicAction as ViewDashboard;
|
final action = dynamicAction as ViewDashboard;
|
||||||
|
|
||||||
if (!store.state.userCompany.canViewDashboard) {
|
|
||||||
store.dispatch(ViewClientList());
|
|
||||||
next(action);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkForChanges(
|
checkForChanges(
|
||||||
store: store,
|
store: store,
|
||||||
force: action.force,
|
force: action.force,
|
||||||
callback: () {
|
callback: () {
|
||||||
if (store.state.isStale) {
|
if (!store.state.userCompany.canViewDashboard) {
|
||||||
store.dispatch(RefreshData());
|
store.dispatch(ViewClientList());
|
||||||
}
|
} else {
|
||||||
|
if (store.state.isStale) {
|
||||||
|
store.dispatch(RefreshData());
|
||||||
|
}
|
||||||
|
|
||||||
store.dispatch(UpdateCurrentRoute(DashboardScreenBuilder.route));
|
store.dispatch(UpdateCurrentRoute(DashboardScreenBuilder.route));
|
||||||
|
}
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
||||||
if (store.state.prefState.isMobile) {
|
if (store.state.prefState.isMobile &&
|
||||||
|
store.state.userCompany.canViewDashboard) {
|
||||||
navigatorKey.currentState.pushNamedAndRemoveUntil(
|
navigatorKey.currentState.pushNamedAndRemoveUntil(
|
||||||
DashboardScreenBuilder.route, (Route<dynamic> route) => false);
|
DashboardScreenBuilder.route, (Route<dynamic> route) => false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue