Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-01-08 11:39:22 +01:00
commit 75d2c9ac32
2 changed files with 8 additions and 9 deletions

View File

@ -62,7 +62,7 @@ async function getData() {
filter: $props.filter, filter: $props.filter,
skip: 0, skip: 0,
}); });
const { data } = await arrayData.fetch({ append: false }); const { data } = await arrayData.fetch({ append: false, updateRouter: false });
entity.value = data; entity.value = data;
emit('onFetch', data); emit('onFetch', data);
} }

View File

@ -58,7 +58,7 @@ export function useArrayData(key, userOptions) {
} }
} }
async function fetch({ append = false }) { async function fetch({ append = false, updateRouter = true }) {
if (!store.url) return; if (!store.url) return;
cancelRequest(); cancelRequest();
@ -100,15 +100,12 @@ export function useArrayData(key, userOptions) {
hasMoreData.value = response.data.length === limit; hasMoreData.value = response.data.length === limit;
if (append === true) { if (append) {
if (!store.data) store.data = []; if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row); for (const row of response.data) store.data.push(row);
} } else {
if (append === false) {
store.data = response.data; store.data = response.data;
updateRouter && updateStateParams();
updateStateParams();
} }
store.isLoading = false; store.isLoading = false;
@ -155,7 +152,9 @@ export function useArrayData(key, userOptions) {
delete store.userParams[param]; delete store.userParams[param];
delete params[param]; delete params[param];
if (store.filter?.where) { if (store.filter?.where) {
delete store.filter.where[Object.keys(exprBuilder ? exprBuilder(param) : param)[0]]; delete store.filter.where[
Object.keys(exprBuilder ? exprBuilder(param) : param)[0]
];
if (Object.keys(store.filter.where).length === 0) { if (Object.keys(store.filter.where).length === 0) {
delete store.filter.where; delete store.filter.where;
} }