mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
code refactor
This commit is contained in:
+21
-21
@@ -171,27 +171,6 @@ export default {
|
||||
password
|
||||
});
|
||||
},
|
||||
getTransactionOverview: ({ today, thisWeek, thisMonth, thisYear }) => {
|
||||
const queryParams = [];
|
||||
|
||||
if (today) {
|
||||
queryParams.push(`today_${today.startTime}_${today.endTime}`);
|
||||
}
|
||||
|
||||
if (thisWeek) {
|
||||
queryParams.push(`thisWeek_${thisWeek.startTime}_${thisWeek.endTime}`);
|
||||
}
|
||||
|
||||
if (thisMonth) {
|
||||
queryParams.push(`thisMonth_${thisMonth.startTime}_${thisMonth.endTime}`);
|
||||
}
|
||||
|
||||
if (thisYear) {
|
||||
queryParams.push(`thisYear_${thisYear.startTime}_${thisYear.endTime}`);
|
||||
}
|
||||
|
||||
return axios.get('v1/overviews/transaction.json' + (queryParams.length ? '?query=' + queryParams.join('|') : ''));
|
||||
},
|
||||
getAllAccounts: ({ visibleOnly }) => {
|
||||
return axios.get('v1/accounts/list.json?visible_only=' + !!visibleOnly);
|
||||
},
|
||||
@@ -255,6 +234,27 @@ export default {
|
||||
|
||||
return axios.get('v1/transactions/statistics.json' + (queryParams.length ? '?' + queryParams.join('&') : ''));
|
||||
},
|
||||
getTransactionAmounts: ({ today, thisWeek, thisMonth, thisYear }) => {
|
||||
const queryParams = [];
|
||||
|
||||
if (today) {
|
||||
queryParams.push(`today_${today.startTime}_${today.endTime}`);
|
||||
}
|
||||
|
||||
if (thisWeek) {
|
||||
queryParams.push(`thisWeek_${thisWeek.startTime}_${thisWeek.endTime}`);
|
||||
}
|
||||
|
||||
if (thisMonth) {
|
||||
queryParams.push(`thisMonth_${thisMonth.startTime}_${thisMonth.endTime}`);
|
||||
}
|
||||
|
||||
if (thisYear) {
|
||||
queryParams.push(`thisYear_${thisYear.startTime}_${thisYear.endTime}`);
|
||||
}
|
||||
|
||||
return axios.get('v1/transactions/amounts.json' + (queryParams.length ? '?query=' + queryParams.join('|') : ''));
|
||||
},
|
||||
getTransaction: ({ id }) => {
|
||||
return axios.get(`v1/transactions/get.json?id=${id}&trim_account=true&trim_category=true&trim_tag=true`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user