Bug fixes
This commit is contained in:
parent
1c561aa36d
commit
155a4f4c64
|
|
@ -35,10 +35,10 @@ class ClientRepository {
|
||||||
|
|
||||||
Future<BuiltList<ClientEntity>> loadList(CompanyEntity company, AuthState auth, int updatedAt) async {
|
Future<BuiltList<ClientEntity>> loadList(CompanyEntity company, AuthState auth, int updatedAt) async {
|
||||||
|
|
||||||
String url = auth.url + '/clients';
|
String url = auth.url + '/clients?';
|
||||||
|
|
||||||
if (updatedAt > 0) {
|
if (updatedAt > 0) {
|
||||||
url += '?updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, company.token);
|
final dynamic response = await webClient.get(url, company.token);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class PaymentRepository {
|
||||||
|
|
||||||
Future<BuiltList<PaymentEntity>> loadList(
|
Future<BuiltList<PaymentEntity>> loadList(
|
||||||
CompanyEntity company, AuthState auth, int updatedAt) async {
|
CompanyEntity company, AuthState auth, int updatedAt) async {
|
||||||
String url = auth.url + '/payments';
|
String url = auth.url + '/payments?';
|
||||||
|
|
||||||
if (updatedAt > 0) {
|
if (updatedAt > 0) {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ class ProductRepository {
|
||||||
|
|
||||||
Future<BuiltList<ProductEntity>> loadList(CompanyEntity company, AuthState auth, int updatedAt) async {
|
Future<BuiltList<ProductEntity>> loadList(CompanyEntity company, AuthState auth, int updatedAt) async {
|
||||||
|
|
||||||
String url = auth.url + '/products';
|
String url = auth.url + '/products?';
|
||||||
|
|
||||||
if (updatedAt > 0) {
|
if (updatedAt > 0) {
|
||||||
url += '?updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, company.token);
|
final dynamic response = await webClient.get(url, company.token);
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,10 @@ class WebClient {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
print('url: $url');
|
||||||
|
|
||||||
if (response.statusCode >= 400) {
|
if (response.statusCode >= 400) {
|
||||||
print('==== FAILED ====');
|
print('==== FAILED ====');
|
||||||
print('url: $url');
|
|
||||||
print('body: ${response.body}');
|
print('body: ${response.body}');
|
||||||
|
|
||||||
throw _parseError(response.body);
|
throw _parseError(response.body);
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,7 @@ Middleware<AppState> _loadClients(ClientRepository repository) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int updatedAt =
|
final int updatedAt = (state.clientState.lastUpdated / 1000).round();
|
||||||
action.force ? 0 : (state.clientState.lastUpdated / 1000).round();
|
|
||||||
|
|
||||||
store.dispatch(LoadClientsRequest());
|
store.dispatch(LoadClientsRequest());
|
||||||
repository
|
repository
|
||||||
|
|
|
||||||
|
|
@ -277,8 +277,7 @@ Middleware<AppState> _loadInvoices(InvoiceRepository repository) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int updatedAt =
|
final int updatedAt = (state.clientState.lastUpdated / 1000).round();
|
||||||
action.force ? 0 : (state.invoiceState.lastUpdated / 1000).round();
|
|
||||||
|
|
||||||
store.dispatch(LoadInvoicesRequest());
|
store.dispatch(LoadInvoicesRequest());
|
||||||
repository
|
repository
|
||||||
|
|
|
||||||
|
|
@ -236,8 +236,7 @@ Middleware<AppState> _loadPayments(PaymentRepository repository) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int updatedAt =
|
final int updatedAt = (state.paymentState.lastUpdated / 1000).round();
|
||||||
action.force ? 0 : (state.paymentState.lastUpdated / 1000).round();
|
|
||||||
|
|
||||||
store.dispatch(LoadPaymentsRequest());
|
store.dispatch(LoadPaymentsRequest());
|
||||||
repository
|
repository
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ Middleware<AppState> _loadProducts(ProductRepository repository) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int updatedAt = action.force ? 0 : (state.productState.lastUpdated / 1000).round();
|
final int updatedAt = (state.clientState.lastUpdated / 1000).round();
|
||||||
|
|
||||||
store.dispatch(LoadProductsRequest());
|
store.dispatch(LoadProductsRequest());
|
||||||
repository.loadList(state.selectedCompany, state.authState, updatedAt).then((data) {
|
repository.loadList(state.selectedCompany, state.authState, updatedAt).then((data) {
|
||||||
|
|
|
||||||
|
|
@ -296,8 +296,7 @@ Middleware<AppState> _loadQuotes(QuoteRepository repository) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int updatedAt =
|
final int updatedAt = (state.quoteState.lastUpdated / 1000).round();
|
||||||
action.force ? 0 : (state.quoteState.lastUpdated / 1000).round();
|
|
||||||
|
|
||||||
store.dispatch(LoadQuotesRequest());
|
store.dispatch(LoadQuotesRequest());
|
||||||
repository
|
repository
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class StubRepository {
|
||||||
|
|
||||||
Future<BuiltList<StubEntity>> loadList(
|
Future<BuiltList<StubEntity>> loadList(
|
||||||
CompanyEntity company, AuthState auth, int updatedAt) async {
|
CompanyEntity company, AuthState auth, int updatedAt) async {
|
||||||
String url = auth.url + '/stubs';
|
String url = auth.url + '/stubs?';
|
||||||
|
|
||||||
if (updatedAt > 0) {
|
if (updatedAt > 0) {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,7 @@ Middleware<AppState> _loadStubs(StubRepository repository) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int updatedAt =
|
final int updatedAt = (state.stubState.lastUpdated / 1000).round();
|
||||||
action.force ? 0 : (state.stubState.lastUpdated / 1000).round();
|
|
||||||
|
|
||||||
store.dispatch(LoadStubsRequest());
|
store.dispatch(LoadStubsRequest());
|
||||||
repository
|
repository
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue