Dashboard not loading #30

This commit is contained in:
Hillel Coren 2018-09-12 18:52:50 -07:00
parent 1d2acd8285
commit a620940ccb
8 changed files with 3 additions and 40 deletions

View File

@ -117,7 +117,6 @@ final clientsReducer = combineReducers<ClientState>([
TypedReducer<ClientState, SaveClientSuccess>(_updateClient), TypedReducer<ClientState, SaveClientSuccess>(_updateClient),
TypedReducer<ClientState, AddClientSuccess>(_addClient), TypedReducer<ClientState, AddClientSuccess>(_addClient),
TypedReducer<ClientState, LoadClientsSuccess>(_setLoadedClients), TypedReducer<ClientState, LoadClientsSuccess>(_setLoadedClients),
TypedReducer<ClientState, LoadClientsFailure>(_setNoClients),
TypedReducer<ClientState, LoadClientSuccess>(_setLoadedClient), TypedReducer<ClientState, LoadClientSuccess>(_setLoadedClient),
TypedReducer<ClientState, ArchiveClientRequest>(_archiveClientRequest), TypedReducer<ClientState, ArchiveClientRequest>(_archiveClientRequest),
TypedReducer<ClientState, ArchiveClientSuccess>(_archiveClientSuccess), TypedReducer<ClientState, ArchiveClientSuccess>(_archiveClientSuccess),
@ -204,10 +203,6 @@ ClientState _setLoadedClient(
b..lastUpdatedActivities = DateTime.now().millisecondsSinceEpoch)); b..lastUpdatedActivities = DateTime.now().millisecondsSinceEpoch));
} }
ClientState _setNoClients(ClientState clientState, LoadClientsFailure action) {
return clientState;
}
ClientState _setLoadedClients( ClientState _setLoadedClients(
ClientState clientState, LoadClientsSuccess action) { ClientState clientState, LoadClientsSuccess action) {
final state = clientState.rebuild((b) => b final state = clientState.rebuild((b) => b

View File

@ -59,6 +59,9 @@ Middleware<AppState> _createLoadDashboard(DashboardRepository repository) {
} }
}).catchError((Object error) { }).catchError((Object error) {
print(error); print(error);
if (action.completer != null) {
action.completer.completeError(error);
}
store.dispatch(LoadDashboardFailure(error)); store.dispatch(LoadDashboardFailure(error));
}); });

View File

@ -4,7 +4,6 @@ import 'package:invoiceninja_flutter/redux/dashboard/dashboard_state.dart';
final dashboardReducer = combineReducers<DashboardState>([ final dashboardReducer = combineReducers<DashboardState>([
TypedReducer<DashboardState, LoadDashboardSuccess>(_setLoadedDashboards), TypedReducer<DashboardState, LoadDashboardSuccess>(_setLoadedDashboards),
TypedReducer<DashboardState, LoadDashboardFailure>(_setNoDashboards),
]); ]);
DashboardState _setLoadedDashboards(DashboardState dashboardState, LoadDashboardSuccess action) { DashboardState _setLoadedDashboards(DashboardState dashboardState, LoadDashboardSuccess action) {
@ -13,9 +12,3 @@ DashboardState _setLoadedDashboards(DashboardState dashboardState, LoadDashboard
..data.replace(action.data) ..data.replace(action.data)
); );
} }
DashboardState _setNoDashboards(DashboardState dashboardState, LoadDashboardFailure action) {
return dashboardState.rebuild((b) => b
..data = null
);
}

View File

@ -157,7 +157,6 @@ final invoicesReducer = combineReducers<InvoiceState>([
TypedReducer<InvoiceState, SaveInvoiceSuccess>(_updateInvoice), TypedReducer<InvoiceState, SaveInvoiceSuccess>(_updateInvoice),
TypedReducer<InvoiceState, AddInvoiceSuccess>(_addInvoice), TypedReducer<InvoiceState, AddInvoiceSuccess>(_addInvoice),
TypedReducer<InvoiceState, LoadInvoicesSuccess>(_setLoadedInvoices), TypedReducer<InvoiceState, LoadInvoicesSuccess>(_setLoadedInvoices),
TypedReducer<InvoiceState, LoadInvoicesFailure>(_setNoInvoices),
TypedReducer<InvoiceState, LoadInvoiceSuccess>(_updateInvoice), TypedReducer<InvoiceState, LoadInvoiceSuccess>(_updateInvoice),
TypedReducer<InvoiceState, MarkSentInvoiceSuccess>(_markSentInvoiceSuccess), TypedReducer<InvoiceState, MarkSentInvoiceSuccess>(_markSentInvoiceSuccess),
TypedReducer<InvoiceState, ArchiveInvoiceRequest>(_archiveInvoiceRequest), TypedReducer<InvoiceState, ArchiveInvoiceRequest>(_archiveInvoiceRequest),
@ -249,11 +248,6 @@ InvoiceState _updateInvoice(InvoiceState invoiceState, dynamic action) {
.rebuild((b) => b..map[action.invoice.id] = action.invoice); .rebuild((b) => b..map[action.invoice.id] = action.invoice);
} }
InvoiceState _setNoInvoices(
InvoiceState invoiceState, LoadInvoicesFailure action) {
return invoiceState;
}
InvoiceState _setLoadedInvoices( InvoiceState _setLoadedInvoices(
InvoiceState invoiceState, LoadInvoicesSuccess action) { InvoiceState invoiceState, LoadInvoicesSuccess action) {
final state = invoiceState.rebuild((b) => b final state = invoiceState.rebuild((b) => b

View File

@ -100,7 +100,6 @@ final paymentsReducer = combineReducers<PaymentState>([
TypedReducer<PaymentState, SavePaymentSuccess>(_updatePayment), TypedReducer<PaymentState, SavePaymentSuccess>(_updatePayment),
TypedReducer<PaymentState, AddPaymentSuccess>(_addPayment), TypedReducer<PaymentState, AddPaymentSuccess>(_addPayment),
TypedReducer<PaymentState, LoadPaymentsSuccess>(_setLoadedPayments), TypedReducer<PaymentState, LoadPaymentsSuccess>(_setLoadedPayments),
TypedReducer<PaymentState, LoadPaymentsFailure>(_setNoPayments),
TypedReducer<PaymentState, LoadPaymentSuccess>(_setLoadedPayment), TypedReducer<PaymentState, LoadPaymentSuccess>(_setLoadedPayment),
TypedReducer<PaymentState, ArchivePaymentRequest>(_archivePaymentRequest), TypedReducer<PaymentState, ArchivePaymentRequest>(_archivePaymentRequest),
TypedReducer<PaymentState, ArchivePaymentSuccess>(_archivePaymentSuccess), TypedReducer<PaymentState, ArchivePaymentSuccess>(_archivePaymentSuccess),
@ -192,11 +191,6 @@ PaymentState _setLoadedPayment(
.rebuild((b) => b..map[action.payment.id] = action.payment); .rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _setNoPayments(
PaymentState paymentState, LoadPaymentsFailure action) {
return paymentState;
}
PaymentState _setLoadedPayments( PaymentState _setLoadedPayments(
PaymentState paymentState, LoadPaymentsSuccess action) { PaymentState paymentState, LoadPaymentsSuccess action) {
final state = paymentState.rebuild((b) => b final state = paymentState.rebuild((b) => b

View File

@ -93,7 +93,6 @@ final productsReducer = combineReducers<ProductState>([
TypedReducer<ProductState, SaveProductSuccess>(_updateProduct), TypedReducer<ProductState, SaveProductSuccess>(_updateProduct),
TypedReducer<ProductState, AddProductSuccess>(_addProduct), TypedReducer<ProductState, AddProductSuccess>(_addProduct),
TypedReducer<ProductState, LoadProductsSuccess>(_setLoadedProducts), TypedReducer<ProductState, LoadProductsSuccess>(_setLoadedProducts),
TypedReducer<ProductState, LoadProductsFailure>(_setNoProducts),
TypedReducer<ProductState, ArchiveProductRequest>(_archiveProductRequest), TypedReducer<ProductState, ArchiveProductRequest>(_archiveProductRequest),
TypedReducer<ProductState, ArchiveProductSuccess>(_archiveProductSuccess), TypedReducer<ProductState, ArchiveProductSuccess>(_archiveProductSuccess),
TypedReducer<ProductState, ArchiveProductFailure>(_archiveProductFailure), TypedReducer<ProductState, ArchiveProductFailure>(_archiveProductFailure),
@ -178,11 +177,6 @@ ProductState _updateProduct(
.rebuild((b) => b..map[action.product.id] = action.product); .rebuild((b) => b..map[action.product.id] = action.product);
} }
ProductState _setNoProducts(
ProductState productState, LoadProductsFailure action) {
return productState;
}
ProductState _setLoadedProducts( ProductState _setLoadedProducts(
ProductState productState, LoadProductsSuccess action) { ProductState productState, LoadProductsSuccess action) {
final state = productState.rebuild((b) => b final state = productState.rebuild((b) => b

View File

@ -151,7 +151,6 @@ final quotesReducer = combineReducers<QuoteState>([
TypedReducer<QuoteState, SaveQuoteSuccess>(_updateQuote), TypedReducer<QuoteState, SaveQuoteSuccess>(_updateQuote),
TypedReducer<QuoteState, AddQuoteSuccess>(_addQuote), TypedReducer<QuoteState, AddQuoteSuccess>(_addQuote),
TypedReducer<QuoteState, LoadQuotesSuccess>(_setLoadedQuotes), TypedReducer<QuoteState, LoadQuotesSuccess>(_setLoadedQuotes),
TypedReducer<QuoteState, LoadQuotesFailure>(_setNoQuotes),
TypedReducer<QuoteState, LoadQuoteSuccess>(_updateQuote), TypedReducer<QuoteState, LoadQuoteSuccess>(_updateQuote),
TypedReducer<QuoteState, MarkSentQuoteSuccess>(_markSentQuoteSuccess), TypedReducer<QuoteState, MarkSentQuoteSuccess>(_markSentQuoteSuccess),
TypedReducer<QuoteState, ArchiveQuoteRequest>(_archiveQuoteRequest), TypedReducer<QuoteState, ArchiveQuoteRequest>(_archiveQuoteRequest),
@ -235,10 +234,6 @@ QuoteState _updateQuote(QuoteState quoteState, dynamic action) {
return quoteState.rebuild((b) => b..map[action.quote.id] = action.quote); 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) { QuoteState _setLoadedQuotes(QuoteState quoteState, LoadQuotesSuccess action) {
final state = quoteState.rebuild((b) => b final state = quoteState.rebuild((b) => b
..lastUpdated = DateTime.now().millisecondsSinceEpoch ..lastUpdated = DateTime.now().millisecondsSinceEpoch

View File

@ -99,7 +99,6 @@ final stubsReducer = combineReducers<StubState>([
TypedReducer<StubState, SaveStubSuccess>(_updateStub), TypedReducer<StubState, SaveStubSuccess>(_updateStub),
TypedReducer<StubState, AddStubSuccess>(_addStub), TypedReducer<StubState, AddStubSuccess>(_addStub),
TypedReducer<StubState, LoadStubsSuccess>(_setLoadedStubs), TypedReducer<StubState, LoadStubsSuccess>(_setLoadedStubs),
TypedReducer<StubState, LoadStubsFailure>(_setNoStubs),
TypedReducer<StubState, LoadStubSuccess>(_setLoadedStub), TypedReducer<StubState, LoadStubSuccess>(_setLoadedStub),
TypedReducer<StubState, ArchiveStubRequest>(_archiveStubRequest), TypedReducer<StubState, ArchiveStubRequest>(_archiveStubRequest),
TypedReducer<StubState, ArchiveStubSuccess>(_archiveStubSuccess), TypedReducer<StubState, ArchiveStubSuccess>(_archiveStubSuccess),
@ -184,10 +183,6 @@ StubState _setLoadedStub(
..map[action.stub.id] = action.stub); ..map[action.stub.id] = action.stub);
} }
StubState _setNoStubs(StubState stubState, LoadStubsFailure action) {
return stubState;
}
StubState _setLoadedStubs( StubState _setLoadedStubs(
StubState stubState, LoadStubsSuccess action) { StubState stubState, LoadStubsSuccess action) {
final state = stubState.rebuild((b) => b final state = stubState.rebuild((b) => b