diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue
index 6a9de44cb..4e284d8e4 100644
--- a/src/components/ui/VnSearchbar.vue
+++ b/src/components/ui/VnSearchbar.vue
@@ -100,7 +100,9 @@ onMounted(() => {
});
async function search() {
- const staticParams = Object.entries(store.userParams);
+ const staticParams = Object.keys(store.userParams ?? {}).length
+ ? store.userParams
+ : store.defaultParams;
arrayData.resetPagination();
const filter = {
@@ -112,7 +114,7 @@ async function search() {
if (!props.searchRemoveParams || !searchText.value) {
filter.params = {
- ...Object.fromEntries(staticParams),
+ ...staticParams,
search: searchText.value,
};
}
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index f4b30438a..1a91cc50b 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -64,6 +64,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
store[option] = userOptions.keepOpts?.includes(option)
? Object.assign(defaultOpts, store[option])
: defaultOpts;
+ if (option === 'userParams') store.defaultParams = store[option];
}
}
}
diff --git a/src/pages/Account/AccountList.vue b/src/pages/Account/AccountList.vue
index 997e31041..7004abcf1 100644
--- a/src/pages/Account/AccountList.vue
+++ b/src/pages/Account/AccountList.vue
@@ -1,10 +1,11 @@
+ (roles = data)" auto-load />
{
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
- cy.visit('#/customer/list');
+ cy.visit('#/account/list');
});
- it('should redirect to customer summary page', () => {
+ it('should redirect to account summary page', () => {
searchAndCheck('1', employeeId);
searchAndCheck('salesPerson', salesPersonId);
});
@@ -20,7 +20,6 @@ describe('VnSearchBar', () => {
checkTableLength(2);
cy.clearSearchbar();
-
cy.writeSearchbar('0{enter}');
checkTableLength(0);
});