This commit is contained in:
Hillel Coren 2018-09-03 12:41:42 -07:00
parent 15a2ece833
commit 87e83aa461
13 changed files with 110 additions and 96 deletions

View File

@ -15,19 +15,20 @@ class CreditsRepository {
this.webClient = const WebClient(), this.webClient = const WebClient(),
}); });
Future<BuiltList<CreditEntity>> loadList(CompanyEntity company, AuthState auth) async { Future<BuiltList<CreditEntity>> loadList(
CompanyEntity company, AuthState auth) async {
final dynamic response =
await webClient.get(auth.url + '/credits?per_page=500', company.token);
final dynamic response = await webClient.get( final CreditListResponse creditResponse =
auth.url + '/credits?per_page=500', company.token); serializers.deserializeWith(CreditListResponse.serializer, response);
final CreditListResponse creditResponse = serializers.deserializeWith(
CreditListResponse.serializer, response);
return creditResponse.data; return creditResponse.data;
} }
Future saveData(CompanyEntity company, AuthState auth, CreditEntity credit, [EntityAction action]) async { Future<CreditEntity> saveData(
CompanyEntity company, AuthState auth, CreditEntity credit,
[EntityAction action]) async {
final data = serializers.serializeWith(CreditEntity.serializer, credit); final data = serializers.serializeWith(CreditEntity.serializer, credit);
dynamic response; dynamic response;
@ -42,8 +43,8 @@ class CreditsRepository {
response = await webClient.put(url, company.token, json.encode(data)); response = await webClient.put(url, company.token, json.encode(data));
} }
final CreditItemResponse creditResponse = serializers.deserializeWith( final CreditItemResponse creditResponse =
CreditItemResponse.serializer, response); serializers.deserializeWith(CreditItemResponse.serializer, response);
return creditResponse.data; return creditResponse.data;
} }

View File

@ -15,19 +15,20 @@ class ExpenseRepository {
this.webClient = const WebClient(), this.webClient = const WebClient(),
}); });
Future<BuiltList<ExpenseEntity>> loadList(CompanyEntity company, AuthState auth) async { Future<BuiltList<ExpenseEntity>> loadList(
CompanyEntity company, AuthState auth) async {
final dynamic response =
await webClient.get(auth.url + '/expenses?per_page=500', company.token);
final dynamic response = await webClient.get( final ExpenseListResponse expenseResponse =
auth.url + '/expenses?per_page=500', company.token); serializers.deserializeWith(ExpenseListResponse.serializer, response);
final ExpenseListResponse expenseResponse = serializers.deserializeWith(
ExpenseListResponse.serializer, response);
return expenseResponse.data; return expenseResponse.data;
} }
Future saveData(CompanyEntity company, AuthState auth, ExpenseEntity expense, [EntityAction action]) async { Future<ExpenseEntity> saveData(
CompanyEntity company, AuthState auth, ExpenseEntity expense,
[EntityAction action]) async {
final data = serializers.serializeWith(ExpenseEntity.serializer, expense); final data = serializers.serializeWith(ExpenseEntity.serializer, expense);
dynamic response; dynamic response;
@ -42,8 +43,8 @@ class ExpenseRepository {
response = await webClient.put(url, company.token, json.encode(data)); response = await webClient.put(url, company.token, json.encode(data));
} }
final ExpenseItemResponse expenseResponse = serializers.deserializeWith( final ExpenseItemResponse expenseResponse =
ExpenseItemResponse.serializer, response); serializers.deserializeWith(ExpenseItemResponse.serializer, response);
return expenseResponse.data; return expenseResponse.data;
} }

View File

@ -33,7 +33,7 @@ class PaymentRepository {
return paymentResponse.data; return paymentResponse.data;
} }
Future saveData(CompanyEntity company, AuthState auth, PaymentEntity payment, Future<PaymentEntity> saveData(CompanyEntity company, AuthState auth, PaymentEntity payment,
[EntityAction action]) async { [EntityAction action]) async {
final data = serializers.serializeWith(PaymentEntity.serializer, payment); final data = serializers.serializeWith(PaymentEntity.serializer, payment);
dynamic response; dynamic response;

View File

@ -15,19 +15,20 @@ class ProjectsRepository {
this.webClient = const WebClient(), this.webClient = const WebClient(),
}); });
Future<BuiltList<ProjectEntity>> loadList(CompanyEntity company, AuthState auth) async { Future<BuiltList<ProjectEntity>> loadList(
CompanyEntity company, AuthState auth) async {
final dynamic response =
await webClient.get(auth.url + '/projects?per_page=500', company.token);
final dynamic response = await webClient.get( final ProjectListResponse projectResponse =
auth.url + '/projects?per_page=500', company.token); serializers.deserializeWith(ProjectListResponse.serializer, response);
final ProjectListResponse projectResponse = serializers.deserializeWith(
ProjectListResponse.serializer, response);
return projectResponse.data; return projectResponse.data;
} }
Future saveData(CompanyEntity company, AuthState auth, ProjectEntity project, [EntityAction action]) async { Future<ProjectEntity> saveData(
CompanyEntity company, AuthState auth, ProjectEntity project,
[EntityAction action]) async {
final data = serializers.serializeWith(ProjectEntity.serializer, project); final data = serializers.serializeWith(ProjectEntity.serializer, project);
dynamic response; dynamic response;
@ -42,8 +43,8 @@ class ProjectsRepository {
response = await webClient.put(url, company.token, json.encode(data)); response = await webClient.put(url, company.token, json.encode(data));
} }
final ProjectItemResponse projectResponse = serializers.deserializeWith( final ProjectItemResponse projectResponse =
ProjectItemResponse.serializer, response); serializers.deserializeWith(ProjectItemResponse.serializer, response);
return projectResponse.data; return projectResponse.data;
} }

View File

@ -15,19 +15,20 @@ class TasksRepository {
this.webClient = const WebClient(), this.webClient = const WebClient(),
}); });
Future<BuiltList<TaskEntity>> loadList(CompanyEntity company, AuthState auth) async { Future<BuiltList<TaskEntity>> loadList(
CompanyEntity company, AuthState auth) async {
final dynamic response =
await webClient.get(auth.url + '/tasks?per_page=500', company.token);
final dynamic response = await webClient.get( final TaskListResponse taskResponse =
auth.url + '/tasks?per_page=500', company.token); serializers.deserializeWith(TaskListResponse.serializer, response);
final TaskListResponse taskResponse = serializers.deserializeWith(
TaskListResponse.serializer, response);
return taskResponse.data; return taskResponse.data;
} }
Future saveData(CompanyEntity company, AuthState auth, TaskEntity task, [EntityAction action]) async { Future<TaskEntity> saveData(
CompanyEntity company, AuthState auth, TaskEntity task,
[EntityAction action]) async {
final data = serializers.serializeWith(TaskEntity.serializer, task); final data = serializers.serializeWith(TaskEntity.serializer, task);
dynamic response; dynamic response;
@ -42,8 +43,8 @@ class TasksRepository {
response = await webClient.put(url, company.token, json.encode(data)); response = await webClient.put(url, company.token, json.encode(data));
} }
final TaskItemResponse taskResponse = serializers.deserializeWith( final TaskItemResponse taskResponse =
TaskItemResponse.serializer, response); serializers.deserializeWith(TaskItemResponse.serializer, response);
return taskResponse.data; return taskResponse.data;
} }

View File

@ -15,19 +15,20 @@ class VendorRepository {
this.webClient = const WebClient(), this.webClient = const WebClient(),
}); });
Future<BuiltList<VendorEntity>> loadList(CompanyEntity company, AuthState auth) async { Future<BuiltList<VendorEntity>> loadList(
CompanyEntity company, AuthState auth) async {
final dynamic response =
await webClient.get(auth.url + '/vendors?per_page=500', company.token);
final dynamic response = await webClient.get( final VendorListResponse vendorResponse =
auth.url + '/vendors?per_page=500', company.token); serializers.deserializeWith(VendorListResponse.serializer, response);
final VendorListResponse vendorResponse = serializers.deserializeWith(
VendorListResponse.serializer, response);
return vendorResponse.data; return vendorResponse.data;
} }
Future saveData(CompanyEntity company, AuthState auth, VendorEntity vendor, [EntityAction action]) async { Future<VendorEntity> saveData(
CompanyEntity company, AuthState auth, VendorEntity vendor,
[EntityAction action]) async {
final data = serializers.serializeWith(VendorEntity.serializer, vendor); final data = serializers.serializeWith(VendorEntity.serializer, vendor);
dynamic response; dynamic response;
@ -42,8 +43,8 @@ class VendorRepository {
response = await webClient.put(url, company.token, json.encode(data)); response = await webClient.put(url, company.token, json.encode(data));
} }
final VendorItemResponse vendorResponse = serializers.deserializeWith( final VendorItemResponse vendorResponse =
VendorItemResponse.serializer, response); serializers.deserializeWith(VendorItemResponse.serializer, response);
return vendorResponse.data; return vendorResponse.data;
} }

View File

@ -82,7 +82,7 @@ Middleware<AppState> _archiveClient(ClientRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origClient, EntityAction.archive) origClient, EntityAction.archive)
.then((dynamic client) { .then((ClientEntity client) {
store.dispatch(ArchiveClientSuccess(client)); store.dispatch(ArchiveClientSuccess(client));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -105,7 +105,7 @@ Middleware<AppState> _deleteClient(ClientRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origClient, EntityAction.delete) origClient, EntityAction.delete)
.then((dynamic client) { .then((ClientEntity client) {
store.dispatch(DeleteClientSuccess(client)); store.dispatch(DeleteClientSuccess(client));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -128,7 +128,7 @@ Middleware<AppState> _restoreClient(ClientRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origClient, EntityAction.restore) origClient, EntityAction.restore)
.then((dynamic client) { .then((ClientEntity client) {
store.dispatch(RestoreClientSuccess(client)); store.dispatch(RestoreClientSuccess(client));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -150,7 +150,7 @@ Middleware<AppState> _saveClient(ClientRepository repository) {
repository repository
.saveData( .saveData(
store.state.selectedCompany, store.state.authState, action.client) store.state.selectedCompany, store.state.authState, action.client)
.then((dynamic client) { .then((ClientEntity client) {
if (action.client.isNew) { if (action.client.isNew) {
store.dispatch(AddClientSuccess(client)); store.dispatch(AddClientSuccess(client));
} else { } else {

View File

@ -95,7 +95,7 @@ Middleware<AppState> _archiveInvoice(InvoiceRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origInvoice, EntityAction.archive) origInvoice, EntityAction.archive)
.then((dynamic invoice) { .then((InvoiceEntity invoice) {
store.dispatch(ArchiveInvoiceSuccess(invoice)); store.dispatch(ArchiveInvoiceSuccess(invoice));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -166,7 +166,7 @@ Middleware<AppState> _markSentInvoice(InvoiceRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origInvoice, EntityAction.markSent) origInvoice, EntityAction.markSent)
.then((dynamic invoice) { .then((InvoiceEntity invoice) {
store.dispatch(MarkSentInvoiceSuccess(invoice)); store.dispatch(MarkSentInvoiceSuccess(invoice));
store.dispatch(LoadClient(clientId: invoice.clientId)); store.dispatch(LoadClient(clientId: invoice.clientId));
if (action.completer != null) { if (action.completer != null) {
@ -213,7 +213,7 @@ Middleware<AppState> _saveInvoice(InvoiceRepository repository) {
repository repository
.saveData( .saveData(
store.state.selectedCompany, store.state.authState, action.invoice) store.state.selectedCompany, store.state.authState, action.invoice)
.then((dynamic invoice) { .then((InvoiceEntity invoice) {
if (action.invoice.isNew) { if (action.invoice.isNew) {
store.dispatch(AddInvoiceSuccess(invoice)); store.dispatch(AddInvoiceSuccess(invoice));
} else { } else {

View File

@ -80,7 +80,7 @@ Middleware<AppState> _archivePayment(PaymentRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origPayment, EntityAction.archive) origPayment, EntityAction.archive)
.then((dynamic payment) { .then((PaymentEntity payment) {
store.dispatch(ArchivePaymentSuccess(payment)); store.dispatch(ArchivePaymentSuccess(payment));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -103,10 +103,10 @@ Middleware<AppState> _deletePayment(PaymentRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origPayment, EntityAction.delete) origPayment, EntityAction.delete)
.then((dynamic payment) { .then((PaymentEntity payment) {
store.dispatch(DeletePaymentSuccess(payment)); store.dispatch(DeletePaymentSuccess(payment));
store.dispatch(LoadClient( store.dispatch(LoadClient(
clientId: paymentInvoiceSelector(payment, store.state).clientId)); clientId: paymentInvoiceSelector(payment.id, store.state).clientId));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
} }
@ -128,10 +128,10 @@ Middleware<AppState> _restorePayment(PaymentRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origPayment, EntityAction.restore) origPayment, EntityAction.restore)
.then((dynamic payment) { .then((PaymentEntity payment) {
store.dispatch(RestorePaymentSuccess(payment)); store.dispatch(RestorePaymentSuccess(payment));
store.dispatch(LoadClient( store.dispatch(LoadClient(
clientId: paymentInvoiceSelector(payment, store.state).clientId)); clientId: paymentInvoiceSelector(payment.id, store.state).clientId));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
} }
@ -152,14 +152,14 @@ Middleware<AppState> _savePayment(PaymentRepository repository) {
repository repository
.saveData( .saveData(
store.state.selectedCompany, store.state.authState, action.payment) store.state.selectedCompany, store.state.authState, action.payment)
.then((dynamic payment) { .then((PaymentEntity payment) {
if (action.payment.isNew) { if (action.payment.isNew) {
store.dispatch(AddPaymentSuccess(payment)); store.dispatch(AddPaymentSuccess(payment));
} else { } else {
store.dispatch(SavePaymentSuccess(payment)); store.dispatch(SavePaymentSuccess(payment));
} }
store.dispatch(LoadClient( store.dispatch(LoadClient(
clientId: paymentInvoiceSelector(payment, store.state).clientId)); clientId: paymentInvoiceSelector(payment.id, store.state).clientId));
action.completer.complete(null); action.completer.complete(null);
}).catchError((Object error) { }).catchError((Object error) {
print(error); print(error);

View File

@ -39,7 +39,6 @@ PaymentEntity _updateEditing(PaymentEntity payment, dynamic action) {
return action.payment; return action.payment;
} }
final paymentListReducer = combineReducers<ListUIState>([ final paymentListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, SortPayments>(_sortPayments), TypedReducer<ListUIState, SortPayments>(_sortPayments),
TypedReducer<ListUIState, FilterPaymentsByState>(_filterPaymentsByState), TypedReducer<ListUIState, FilterPaymentsByState>(_filterPaymentsByState),
@ -77,13 +76,15 @@ ListUIState _filterPaymentsByCustom2(
ListUIState _filterPaymentsByState( ListUIState _filterPaymentsByState(
ListUIState paymentListState, FilterPaymentsByState action) { ListUIState paymentListState, FilterPaymentsByState action) {
if (paymentListState.stateFilters.contains(action.state)) { if (paymentListState.stateFilters.contains(action.state)) {
return paymentListState.rebuild((b) => b..stateFilters.remove(action.state)); return paymentListState
.rebuild((b) => b..stateFilters.remove(action.state));
} else { } else {
return paymentListState.rebuild((b) => b..stateFilters.add(action.state)); return paymentListState.rebuild((b) => b..stateFilters.add(action.state));
} }
} }
ListUIState _filterPayments(ListUIState paymentListState, FilterPayments action) { ListUIState _filterPayments(
ListUIState paymentListState, FilterPayments action) {
return paymentListState.rebuild((b) => b..filter = action.filter); return paymentListState.rebuild((b) => b..filter = action.filter);
} }
@ -120,12 +121,14 @@ PaymentState _archivePaymentRequest(
PaymentState _archivePaymentSuccess( PaymentState _archivePaymentSuccess(
PaymentState paymentState, ArchivePaymentSuccess action) { PaymentState paymentState, ArchivePaymentSuccess action) {
return paymentState.rebuild((b) => b..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _archivePaymentFailure( PaymentState _archivePaymentFailure(
PaymentState paymentState, ArchivePaymentFailure action) { PaymentState paymentState, ArchivePaymentFailure action) {
return paymentState.rebuild((b) => b..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _deletePaymentRequest( PaymentState _deletePaymentRequest(
@ -139,12 +142,14 @@ PaymentState _deletePaymentRequest(
PaymentState _deletePaymentSuccess( PaymentState _deletePaymentSuccess(
PaymentState paymentState, DeletePaymentSuccess action) { PaymentState paymentState, DeletePaymentSuccess action) {
return paymentState.rebuild((b) => b..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _deletePaymentFailure( PaymentState _deletePaymentFailure(
PaymentState paymentState, DeletePaymentFailure action) { PaymentState paymentState, DeletePaymentFailure action) {
return paymentState.rebuild((b) => b..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _restorePaymentRequest( PaymentState _restorePaymentRequest(
@ -157,12 +162,14 @@ PaymentState _restorePaymentRequest(
PaymentState _restorePaymentSuccess( PaymentState _restorePaymentSuccess(
PaymentState paymentState, RestorePaymentSuccess action) { PaymentState paymentState, RestorePaymentSuccess action) {
return paymentState.rebuild((b) => b..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _restorePaymentFailure( PaymentState _restorePaymentFailure(
PaymentState paymentState, RestorePaymentFailure action) { PaymentState paymentState, RestorePaymentFailure action) {
return paymentState.rebuild((b) => b..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _addPayment(PaymentState paymentState, AddPaymentSuccess action) { PaymentState _addPayment(PaymentState paymentState, AddPaymentSuccess action) {
@ -171,18 +178,20 @@ PaymentState _addPayment(PaymentState paymentState, AddPaymentSuccess action) {
..list.add(action.payment.id)); ..list.add(action.payment.id));
} }
PaymentState _updatePayment(PaymentState paymentState, SavePaymentSuccess action) { PaymentState _updatePayment(
return paymentState.rebuild((b) => b PaymentState paymentState, SavePaymentSuccess action) {
..map[action.payment.id] = action.payment); return paymentState
.rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _setLoadedPayment( PaymentState _setLoadedPayment(
PaymentState paymentState, LoadPaymentSuccess action) { PaymentState paymentState, LoadPaymentSuccess action) {
return paymentState.rebuild((b) => b return paymentState
..map[action.payment.id] = action.payment); .rebuild((b) => b..map[action.payment.id] = action.payment);
} }
PaymentState _setNoPayments(PaymentState paymentState, LoadPaymentsFailure action) { PaymentState _setNoPayments(
PaymentState paymentState, LoadPaymentsFailure action) {
return paymentState; return paymentState;
} }

View File

@ -56,7 +56,7 @@ Middleware<AppState> _archiveProduct(ProductRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origProduct, EntityAction.archive) origProduct, EntityAction.archive)
.then((dynamic product) { .then((ProductEntity product) {
store.dispatch(ArchiveProductSuccess(product)); store.dispatch(ArchiveProductSuccess(product));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -79,7 +79,7 @@ Middleware<AppState> _deleteProduct(ProductRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origProduct, EntityAction.delete) origProduct, EntityAction.delete)
.then((dynamic product) { .then((ProductEntity product) {
store.dispatch(DeleteProductSuccess(product)); store.dispatch(DeleteProductSuccess(product));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -102,7 +102,7 @@ Middleware<AppState> _restoreProduct(ProductRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origProduct, EntityAction.restore) origProduct, EntityAction.restore)
.then((dynamic product) { .then((ProductEntity product) {
store.dispatch(RestoreProductSuccess(product)); store.dispatch(RestoreProductSuccess(product));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -124,7 +124,7 @@ Middleware<AppState> _saveProduct(ProductRepository repository) {
repository repository
.saveData( .saveData(
store.state.selectedCompany, store.state.authState, action.product) store.state.selectedCompany, store.state.authState, action.product)
.then((dynamic product) { .then((ProductEntity product) {
if (action.product.isNew) { if (action.product.isNew) {
store.dispatch(AddProductSuccess(product)); store.dispatch(AddProductSuccess(product));
} else { } else {

View File

@ -96,7 +96,7 @@ Middleware<AppState> _archiveQuote(QuoteRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, origQuote, .saveData(store.state.selectedCompany, store.state.authState, origQuote,
EntityAction.archive) EntityAction.archive)
.then((dynamic quote) { .then((InvoiceEntity quote) {
store.dispatch(ArchiveQuoteSuccess(quote)); store.dispatch(ArchiveQuoteSuccess(quote));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -167,7 +167,7 @@ Middleware<AppState> _markSentQuote(QuoteRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, origQuote, .saveData(store.state.selectedCompany, store.state.authState, origQuote,
EntityAction.markSent) EntityAction.markSent)
.then((dynamic quote) { .then((InvoiceEntity quote) {
store.dispatch(MarkSentQuoteSuccess(quote)); store.dispatch(MarkSentQuoteSuccess(quote));
store.dispatch(LoadClient(clientId: quote.clientId)); store.dispatch(LoadClient(clientId: quote.clientId));
if (action.completer != null) { if (action.completer != null) {
@ -214,7 +214,7 @@ Middleware<AppState> _saveQuote(QuoteRepository repository) {
repository repository
.saveData( .saveData(
store.state.selectedCompany, store.state.authState, action.quote) store.state.selectedCompany, store.state.authState, action.quote)
.then((dynamic quote) { .then((InvoiceEntity quote) {
if (action.quote.isNew) { if (action.quote.isNew) {
store.dispatch(AddQuoteSuccess(quote)); store.dispatch(AddQuoteSuccess(quote));
} else { } else {

View File

@ -75,7 +75,7 @@ Middleware<AppState> _archiveStub(StubRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origStub, EntityAction.archive) origStub, EntityAction.archive)
.then((dynamic stub) { .then((StubEntity stub) {
store.dispatch(ArchiveStubSuccess(stub)); store.dispatch(ArchiveStubSuccess(stub));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -98,7 +98,7 @@ Middleware<AppState> _deleteStub(StubRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origStub, EntityAction.delete) origStub, EntityAction.delete)
.then((dynamic stub) { .then((StubEntity stub) {
store.dispatch(DeleteStubSuccess(stub)); store.dispatch(DeleteStubSuccess(stub));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -121,7 +121,7 @@ Middleware<AppState> _restoreStub(StubRepository repository) {
repository repository
.saveData(store.state.selectedCompany, store.state.authState, .saveData(store.state.selectedCompany, store.state.authState,
origStub, EntityAction.restore) origStub, EntityAction.restore)
.then((dynamic stub) { .then((StubEntity stub) {
store.dispatch(RestoreStubSuccess(stub)); store.dispatch(RestoreStubSuccess(stub));
if (action.completer != null) { if (action.completer != null) {
action.completer.complete(null); action.completer.complete(null);
@ -143,7 +143,7 @@ Middleware<AppState> _saveStub(StubRepository repository) {
repository repository
.saveData( .saveData(
store.state.selectedCompany, store.state.authState, action.stub) store.state.selectedCompany, store.state.authState, action.stub)
.then((dynamic stub) { .then((StubEntity stub) {
if (action.stub.isNew) { if (action.stub.isNew) {
store.dispatch(AddStubSuccess(stub)); store.dispatch(AddStubSuccess(stub));
} else { } else {