0
0
Fork 0

refs #6394 fix: some navigation bugs

This commit is contained in:
Javier Segarra 2024-02-19 09:16:26 +01:00
parent 6b363610d2
commit 5093d0b1a6
2 changed files with 16 additions and 1 deletions

View File

@ -63,6 +63,19 @@ onMounted(() => {
emit('init', { params: userParams.value });
});
watch(
() => route.query.params,
(val) => {
if (!val) {
userParams.value = {};
} else {
const parsedParams = JSON.parse(val);
userParams.value = { ...parsedParams };
search();
}
}
);
const isLoading = ref(false);
async function search() {
isLoading.value = true;
@ -70,9 +83,9 @@ async function search() {
store.userParamsChanged = true;
store.filter.skip = 0;
store.skip = 0;
store.userParams = params;
const { params: newParams } = await arrayData.addFilter({ params });
userParams.value = newParams;
if (!props.showAll && !Object.values(params).length) store.data = [];
isLoading.value = false;

View File

@ -27,6 +27,8 @@ export function useArrayData(key, userOptions) {
const query = route.query;
if (query.params) {
store.userParams = JSON.parse(query.params);
store.skip = 0;
store.filter.skip = 0;
}
});