show whether data is updated after pull down

This commit is contained in:
MaysWind
2023-06-18 22:43:47 +08:00
parent 55ad7b2e81
commit eb2e2b0a26
15 changed files with 102 additions and 17 deletions
+6 -1
View File
@@ -353,15 +353,20 @@ export default {
},
reload(done) {
const self = this;
const force = !!done;
self.overviewStore.loadTransactionOverview({
defaultCurrency: self.defaultCurrency,
dateRange: self.dateRange,
force: true
force: force
}).then(() => {
if (done) {
done();
}
if (force) {
self.$toast('Data has been updated');
}
}).catch(error => {
if (done) {
done();
+6 -1
View File
@@ -267,13 +267,18 @@ export default {
}
const self = this;
const force = !!done;
self.accountsStore.loadAllAccounts({
force: true
force: force
}).then(() => {
if (done) {
done();
}
if (force) {
self.$toast('Account list has been updated');
}
}).catch(error => {
if (done) {
done();
+6 -1
View File
@@ -58,13 +58,18 @@ export default {
},
reload(done) {
const self = this;
const force = !!done;
self.transactionCategoriesStore.loadAllCategories({
force: true
force: force
}).then(() => {
if (done) {
done();
}
if (force) {
self.$toast('Category list has been updated');
}
}).catch(error => {
if (done) {
done();
+6 -1
View File
@@ -242,13 +242,18 @@ export default {
}
const self = this;
const force = !!done;
self.transactionCategoriesStore.loadAllCategories({
force: true
force: force
}).then(() => {
if (done) {
done();
}
if (force) {
self.$toast('Category list has been updated');
}
}).catch(error => {
if (done) {
done();
@@ -496,6 +496,7 @@ export default {
},
reload(done) {
const self = this;
const force = !!done;
let dispatchPromise = null;
if (self.query.chartDataType === self.allChartDataTypes.ExpenseByAccount.type ||
@@ -510,7 +511,7 @@ export default {
} else if (self.query.chartDataType === self.allChartDataTypes.AccountTotalAssets.type ||
self.query.chartDataType === self.allChartDataTypes.AccountTotalLiabilities.type) {
dispatchPromise = self.accountsStore.loadAllAccounts({
force: true
force: force
});
}
@@ -519,6 +520,10 @@ export default {
if (done) {
done();
}
if (force) {
self.$toast('Data has been updated');
}
}).catch(error => {
if (done) {
done();
+6 -1
View File
@@ -238,13 +238,18 @@ export default {
}
const self = this;
const force = !!done;
self.transactionTagsStore.loadAllTags({
force: true
force: force
}).then(() => {
if (done) {
done();
}
if (force) {
self.$toast('Tag list has been updated');
}
}).catch(error => {
if (done) {
done();
@@ -590,6 +590,7 @@ export default {
},
reload(done) {
const self = this;
const force = !!done;
if (!done) {
self.loading = true;
@@ -601,6 +602,7 @@ export default {
]).then(() => {
return self.transactionsStore.loadTransactions({
reload: true,
force: force,
autoExpand: true,
defaultCurrency: self.defaultCurrency
});
@@ -609,6 +611,10 @@ export default {
done();
}
if (force) {
self.$toast('Data has been updated');
}
self.loading = false;
}).catch(error => {
if (error.processed || done) {
@@ -48,6 +48,7 @@ import { useUserStore } from '@/stores/user.js';
import { useTokensStore } from '@/stores/token.js';
import iconConstants from '@/consts/icon.js';
import { isEquals } from '@/lib/common.js';
import { parseDeviceInfo, parseUserAgent } from '@/lib/misc.js';
import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
@@ -118,6 +119,12 @@ export default {
done();
}
if (isEquals(self.tokens, tokens)) {
self.$toast('Session list is up to date');
} else {
self.$toast('Session list has been updated');
}
self.tokens = tokens;
}).catch(error => {
if (done) {