forked from verdnatura/salix-front
refactor: refs #8207 improve logic
This commit is contained in:
parent
661cc0b5ee
commit
9d8698fa2f
|
@ -130,19 +130,19 @@ const addFilter = async (filter, params) => {
|
|||
await arrayData.addFilter({ filter, params });
|
||||
};
|
||||
|
||||
async function fetch(params, keepRowsNumber = false) {
|
||||
async function fetch(params, keepPagination = false) {
|
||||
useArrayData(props.dataKey, params);
|
||||
const { limit, skip } = arrayData.store;
|
||||
|
||||
if (keepRowsNumber) {
|
||||
if (!keepPagination) await arrayData.fetch({ append: false });
|
||||
else {
|
||||
arrayData.store.limit = limit + skip;
|
||||
arrayData.store.skip = 0;
|
||||
}
|
||||
await arrayData.fetch({ append: false });
|
||||
if (keepRowsNumber) {
|
||||
await arrayData.fetch({ append: false });
|
||||
arrayData.store.limit = limit;
|
||||
arrayData.store.skip = skip;
|
||||
}
|
||||
|
||||
if (!store.hasMoreData) isLoading.value = false;
|
||||
|
||||
emit('onFetch', store.data);
|
||||
|
|
Loading…
Reference in New Issue