diff --git a/lib/redux/client/client_reducer.dart b/lib/redux/client/client_reducer.dart index 9ceecf954..9a3aa7e42 100644 --- a/lib/redux/client/client_reducer.dart +++ b/lib/redux/client/client_reducer.dart @@ -117,7 +117,6 @@ final clientsReducer = combineReducers([ TypedReducer(_updateClient), TypedReducer(_addClient), TypedReducer(_setLoadedClients), - TypedReducer(_setNoClients), TypedReducer(_setLoadedClient), TypedReducer(_archiveClientRequest), TypedReducer(_archiveClientSuccess), @@ -204,10 +203,6 @@ ClientState _setLoadedClient( b..lastUpdatedActivities = DateTime.now().millisecondsSinceEpoch)); } -ClientState _setNoClients(ClientState clientState, LoadClientsFailure action) { - return clientState; -} - ClientState _setLoadedClients( ClientState clientState, LoadClientsSuccess action) { final state = clientState.rebuild((b) => b diff --git a/lib/redux/dashboard/dashboard_middleware.dart b/lib/redux/dashboard/dashboard_middleware.dart index 1371fd6b5..35cfbdddb 100644 --- a/lib/redux/dashboard/dashboard_middleware.dart +++ b/lib/redux/dashboard/dashboard_middleware.dart @@ -59,6 +59,9 @@ Middleware _createLoadDashboard(DashboardRepository repository) { } }).catchError((Object error) { print(error); + if (action.completer != null) { + action.completer.completeError(error); + } store.dispatch(LoadDashboardFailure(error)); }); diff --git a/lib/redux/dashboard/dashboard_reducer.dart b/lib/redux/dashboard/dashboard_reducer.dart index 3e5982ddc..9933916d7 100644 --- a/lib/redux/dashboard/dashboard_reducer.dart +++ b/lib/redux/dashboard/dashboard_reducer.dart @@ -4,7 +4,6 @@ import 'package:invoiceninja_flutter/redux/dashboard/dashboard_state.dart'; final dashboardReducer = combineReducers([ TypedReducer(_setLoadedDashboards), - TypedReducer(_setNoDashboards), ]); DashboardState _setLoadedDashboards(DashboardState dashboardState, LoadDashboardSuccess action) { @@ -13,9 +12,3 @@ DashboardState _setLoadedDashboards(DashboardState dashboardState, LoadDashboard ..data.replace(action.data) ); } - -DashboardState _setNoDashboards(DashboardState dashboardState, LoadDashboardFailure action) { - return dashboardState.rebuild((b) => b - ..data = null - ); -} diff --git a/lib/redux/invoice/invoice_reducer.dart b/lib/redux/invoice/invoice_reducer.dart index e845fb578..a66b1b558 100644 --- a/lib/redux/invoice/invoice_reducer.dart +++ b/lib/redux/invoice/invoice_reducer.dart @@ -157,7 +157,6 @@ final invoicesReducer = combineReducers([ TypedReducer(_updateInvoice), TypedReducer(_addInvoice), TypedReducer(_setLoadedInvoices), - TypedReducer(_setNoInvoices), TypedReducer(_updateInvoice), TypedReducer(_markSentInvoiceSuccess), TypedReducer(_archiveInvoiceRequest), @@ -249,11 +248,6 @@ InvoiceState _updateInvoice(InvoiceState invoiceState, dynamic action) { .rebuild((b) => b..map[action.invoice.id] = action.invoice); } -InvoiceState _setNoInvoices( - InvoiceState invoiceState, LoadInvoicesFailure action) { - return invoiceState; -} - InvoiceState _setLoadedInvoices( InvoiceState invoiceState, LoadInvoicesSuccess action) { final state = invoiceState.rebuild((b) => b diff --git a/lib/redux/payment/payment_reducer.dart b/lib/redux/payment/payment_reducer.dart index c79867832..9cd5ebbbd 100644 --- a/lib/redux/payment/payment_reducer.dart +++ b/lib/redux/payment/payment_reducer.dart @@ -100,7 +100,6 @@ final paymentsReducer = combineReducers([ TypedReducer(_updatePayment), TypedReducer(_addPayment), TypedReducer(_setLoadedPayments), - TypedReducer(_setNoPayments), TypedReducer(_setLoadedPayment), TypedReducer(_archivePaymentRequest), TypedReducer(_archivePaymentSuccess), @@ -192,11 +191,6 @@ PaymentState _setLoadedPayment( .rebuild((b) => b..map[action.payment.id] = action.payment); } -PaymentState _setNoPayments( - PaymentState paymentState, LoadPaymentsFailure action) { - return paymentState; -} - PaymentState _setLoadedPayments( PaymentState paymentState, LoadPaymentsSuccess action) { final state = paymentState.rebuild((b) => b diff --git a/lib/redux/product/product_reducer.dart b/lib/redux/product/product_reducer.dart index 53e36e1e7..d1620a230 100644 --- a/lib/redux/product/product_reducer.dart +++ b/lib/redux/product/product_reducer.dart @@ -93,7 +93,6 @@ final productsReducer = combineReducers([ TypedReducer(_updateProduct), TypedReducer(_addProduct), TypedReducer(_setLoadedProducts), - TypedReducer(_setNoProducts), TypedReducer(_archiveProductRequest), TypedReducer(_archiveProductSuccess), TypedReducer(_archiveProductFailure), @@ -178,11 +177,6 @@ ProductState _updateProduct( .rebuild((b) => b..map[action.product.id] = action.product); } -ProductState _setNoProducts( - ProductState productState, LoadProductsFailure action) { - return productState; -} - ProductState _setLoadedProducts( ProductState productState, LoadProductsSuccess action) { final state = productState.rebuild((b) => b diff --git a/lib/redux/quote/quote_reducer.dart b/lib/redux/quote/quote_reducer.dart index 5954d917b..2f3c7f3f1 100644 --- a/lib/redux/quote/quote_reducer.dart +++ b/lib/redux/quote/quote_reducer.dart @@ -151,7 +151,6 @@ final quotesReducer = combineReducers([ TypedReducer(_updateQuote), TypedReducer(_addQuote), TypedReducer(_setLoadedQuotes), - TypedReducer(_setNoQuotes), TypedReducer(_updateQuote), TypedReducer(_markSentQuoteSuccess), TypedReducer(_archiveQuoteRequest), @@ -235,10 +234,6 @@ QuoteState _updateQuote(QuoteState quoteState, dynamic action) { return quoteState.rebuild((b) => b..map[action.quote.id] = action.quote); } -QuoteState _setNoQuotes(QuoteState quoteState, LoadQuotesFailure action) { - return quoteState; -} - QuoteState _setLoadedQuotes(QuoteState quoteState, LoadQuotesSuccess action) { final state = quoteState.rebuild((b) => b ..lastUpdated = DateTime.now().millisecondsSinceEpoch diff --git a/stubs/redux/stub/stub_reducer b/stubs/redux/stub/stub_reducer index d89663a2e..fae855d22 100644 --- a/stubs/redux/stub/stub_reducer +++ b/stubs/redux/stub/stub_reducer @@ -99,7 +99,6 @@ final stubsReducer = combineReducers([ TypedReducer(_updateStub), TypedReducer(_addStub), TypedReducer(_setLoadedStubs), - TypedReducer(_setNoStubs), TypedReducer(_setLoadedStub), TypedReducer(_archiveStubRequest), TypedReducer(_archiveStubSuccess), @@ -184,10 +183,6 @@ StubState _setLoadedStub( ..map[action.stub.id] = action.stub); } -StubState _setNoStubs(StubState stubState, LoadStubsFailure action) { - return stubState; -} - StubState _setLoadedStubs( StubState stubState, LoadStubsSuccess action) { final state = stubState.rebuild((b) => b