Improve loading
This commit is contained in:
parent
e5205a830e
commit
f7ae87b158
|
|
@ -102,10 +102,10 @@ class AuthRepository {
|
|||
'company.groups',
|
||||
'company.company_gateways.gateway',
|
||||
'company.clients',
|
||||
'company.products',
|
||||
'company.invoices',
|
||||
'company.payments',
|
||||
'company.quotes',
|
||||
//'company.products',
|
||||
//'company.invoices',
|
||||
//'company.payments',
|
||||
//'company.quotes',
|
||||
//'company.credits',
|
||||
//'company.tasks',
|
||||
//'company.projects',
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ ClientState _setLoadedClients(
|
|||
ClientState _companyLoaded(
|
||||
ClientState clientState, LoadCompanySuccess action) {
|
||||
final clients = action.userCompany.company.clients;
|
||||
if (clients.isEmpty) {
|
||||
if (clients == null || clients.isEmpty) {
|
||||
return clientState;
|
||||
}
|
||||
return clientState.loadClients(clients);
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ ExpenseState _setLoadedExpenses(
|
|||
ExpenseState _companyLoaded(
|
||||
ExpenseState expenseState, LoadCompanySuccess action) {
|
||||
final expenses = action.userCompany.company.expenses;
|
||||
if (expenses.isEmpty) {
|
||||
if (expenses == null || expenses.isEmpty) {
|
||||
return expenseState;
|
||||
}
|
||||
return expenseState.loadExpenses(expenses);
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ InvoiceState _setLoadedInvoices(
|
|||
InvoiceState _companyLoaded(
|
||||
InvoiceState invoiceState, LoadCompanySuccess action) {
|
||||
final invoices = action.userCompany.company.invoices;
|
||||
if (invoices.isEmpty) {
|
||||
if (invoices == null || invoices.isEmpty) {
|
||||
return invoiceState;
|
||||
}
|
||||
return invoiceState.loadInvoices(invoices);
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ PaymentState _setLoadedPayments(
|
|||
PaymentState _companyLoaded(
|
||||
PaymentState paymentState, LoadCompanySuccess action) {
|
||||
final payments = action.userCompany.company.payments;
|
||||
if (payments.isEmpty) {
|
||||
if (payments == null || payments.isEmpty) {
|
||||
return paymentState;
|
||||
}
|
||||
return paymentState.loadPayments(payments);
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ ProductState _setLoadedProducts(
|
|||
ProductState _companyLoaded(
|
||||
ProductState productState, LoadCompanySuccess action) {
|
||||
final products = action.userCompany.company.products;
|
||||
if (products.isEmpty) {
|
||||
if (products == null || products.isEmpty) {
|
||||
return productState;
|
||||
}
|
||||
return productState.loadProducts(products);
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ ProjectState _setLoadedProjects(
|
|||
ProjectState _companyLoaded(
|
||||
ProjectState projectState, LoadCompanySuccess action) {
|
||||
final projects = action.userCompany.company.projects;
|
||||
if (projects.isEmpty) {
|
||||
if (projects == null || projects.isEmpty) {
|
||||
return projectState;
|
||||
}
|
||||
return projectState.loadProjects(projects);
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ QuoteState _setLoadedQuotes(QuoteState quoteState, LoadQuotesSuccess action) =>
|
|||
QuoteState _companyLoaded(
|
||||
QuoteState quoteState, LoadCompanySuccess action) {
|
||||
final quotes = action.userCompany.company.quotes;
|
||||
if (quotes.isEmpty) {
|
||||
if (quotes == null || quotes.isEmpty) {
|
||||
return quoteState;
|
||||
}
|
||||
return quoteState.loadQuotes(quotes);
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ TaskState _setLoadedTasks(TaskState taskState, LoadTasksSuccess action) =>
|
|||
TaskState _companyLoaded(
|
||||
TaskState taskState, LoadCompanySuccess action) {
|
||||
final tasks = action.userCompany.company.tasks;
|
||||
if (tasks.isEmpty) {
|
||||
if (tasks == null || tasks.isEmpty) {
|
||||
return taskState;
|
||||
}
|
||||
return taskState.loadTasks(tasks);
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ VendorState _setLoadedVendors(
|
|||
VendorState _companyLoaded(
|
||||
VendorState vendorState, LoadCompanySuccess action) {
|
||||
final vendors = action.userCompany.company.vendors;
|
||||
if (vendors.isEmpty) {
|
||||
if (vendors == null || vendors.isEmpty) {
|
||||
return vendorState;
|
||||
}
|
||||
return vendorState.loadVendors(vendors);
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ StubState _setLoadedStubs(
|
|||
StubState _companyLoaded(
|
||||
StubState stubState, LoadCompanySuccess action) {
|
||||
final stubs = action.userCompany.company.stubs;
|
||||
if (stubs.isEmpty) {
|
||||
if (stubs == null || stubs.isEmpty) {
|
||||
return stubState;
|
||||
}
|
||||
return stubState.loadStubs(stubs);
|
||||
|
|
|
|||
Loading…
Reference in New Issue