mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
show whether data is updated after pull down
This commit is contained in:
@@ -6,7 +6,7 @@ import { useExchangeRatesStore } from './exchangeRates.js';
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import services from '@/lib/services.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
import { isNumber } from '@/lib/common.js';
|
||||
import { isNumber, isEquals } from '@/lib/common.js';
|
||||
import { getCategorizedAccounts, getAllFilteredAccountsBalance } from '@/lib/account.js';
|
||||
|
||||
function loadAccountList(state, accounts) {
|
||||
@@ -537,12 +537,17 @@ export const useAccountsStore = defineStore('accounts', {
|
||||
return;
|
||||
}
|
||||
|
||||
loadAccountList(self, data.result);
|
||||
|
||||
if (self.accountListStateInvalid) {
|
||||
self.updateAccountListInvalidState(false);
|
||||
}
|
||||
|
||||
if (force && data.result && isEquals(self.allAccounts, data.result)) {
|
||||
reject({ message: 'Account list is up to date' });
|
||||
return;
|
||||
}
|
||||
|
||||
loadAccountList(self, data.result);
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
if (force) {
|
||||
|
||||
@@ -81,7 +81,7 @@ export const useExchangeRatesStore = defineStore('exchangeRates', {
|
||||
|
||||
const currentData = getExchangeRatesFromLocalStorage();
|
||||
|
||||
if (currentData && currentData.data && isEquals(currentData.data, data.result)) {
|
||||
if (force && currentData && currentData.data && isEquals(currentData.data, data.result)) {
|
||||
reject({ message: 'Exchange rates data is up to date' });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ import { defineStore } from 'pinia';
|
||||
|
||||
import { useExchangeRatesStore } from './exchangeRates.js';
|
||||
|
||||
import { isNumber, isEquals } from '@/lib/common.js';
|
||||
import services from '@/lib/services.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
import { isNumber } from '@/lib/common.js';
|
||||
|
||||
export const useOverviewStore = defineStore('overview', {
|
||||
state: () => ({
|
||||
@@ -91,12 +91,17 @@ export const useOverviewStore = defineStore('overview', {
|
||||
item.incompleteExpenseAmount = hasUnCalculatedTotalExpense;
|
||||
}
|
||||
|
||||
self.transactionOverview = overview;
|
||||
|
||||
if (self.transactionOverviewStateInvalid) {
|
||||
self.updateTransactionOverviewInvalidState(false);
|
||||
}
|
||||
|
||||
if (force && overview && isEquals(self.transactionOverview, overview)) {
|
||||
reject({ message: 'Data is up to date' });
|
||||
return;
|
||||
}
|
||||
|
||||
self.transactionOverview = overview;
|
||||
|
||||
resolve(overview);
|
||||
}).catch(error => {
|
||||
if (force) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { isEquals } from '@/lib/common.js';
|
||||
import services from '@/lib/services.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
|
||||
@@ -179,12 +180,17 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
|
||||
}
|
||||
}
|
||||
|
||||
loadTransactionCategoryList(self, data.result);
|
||||
|
||||
if (self.transactionCategoryListStateInvalid) {
|
||||
self.updateTransactionCategoryListInvalidState(false);
|
||||
}
|
||||
|
||||
if (force && data.result && isEquals(self.allTransactionCategories, data.result)) {
|
||||
reject({ message: 'Category list is up to date' });
|
||||
return;
|
||||
}
|
||||
|
||||
loadTransactionCategoryList(self, data.result);
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
if (force) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { isEquals } from '@/lib/common.js';
|
||||
import services from '@/lib/services.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
|
||||
@@ -85,12 +86,17 @@ export const useTransactionTagsStore = defineStore('transactionTags', {
|
||||
return;
|
||||
}
|
||||
|
||||
loadTransactionTagList(self, data.result);
|
||||
|
||||
if (self.transactionTagListStateInvalid) {
|
||||
self.updateTransactionTagListInvalidState(false);
|
||||
}
|
||||
|
||||
if (force && data.result && isEquals(self.allTransactionTags, data.result)) {
|
||||
reject({ message: 'Tag list is up to date' });
|
||||
return;
|
||||
}
|
||||
|
||||
loadTransactionTagList(self, data.result);
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
if (force) {
|
||||
|
||||
Reference in New Issue
Block a user