@webitel/ui-sdk 3.2.12 → 3.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -3,11 +3,6 @@ import isEmpty from '../../../scripts/isEmpty';
|
|
|
3
3
|
import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule';
|
|
4
4
|
|
|
5
5
|
export default class FiltersStoreModule extends BaseStoreModule {
|
|
6
|
-
constructor({ router }) {
|
|
7
|
-
super();
|
|
8
|
-
this.router = router;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
getters = {
|
|
12
7
|
GET_FILTERS: (state, getters) => Object.keys(state)
|
|
13
8
|
.reduce((filters, filterKey) => {
|
|
@@ -23,8 +18,8 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
23
18
|
if (storedProp) return value[storedProp]; // if object and has specific prop, return this prop
|
|
24
19
|
return value; // else return val
|
|
25
20
|
},
|
|
26
|
-
GET_VALUE_FROM_QUERY: () => ({ filterQuery }) => (
|
|
27
|
-
|
|
21
|
+
GET_VALUE_FROM_QUERY: (context) => ({ filterQuery }) => (
|
|
22
|
+
context.state.router.currentRoute.value.query[filterQuery]
|
|
28
23
|
),
|
|
29
24
|
};
|
|
30
25
|
|
|
@@ -67,11 +62,11 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
67
62
|
},
|
|
68
63
|
CHANGE_ROUTE_QUERY: (context, { value, filterQuery }) => {
|
|
69
64
|
if (deepEqual(context.getters.GET_VALUE_FROM_QUERY({ filterQuery }), value)) return;
|
|
70
|
-
const query = { ...
|
|
65
|
+
const query = { ...context.state.router.currentRoute.value.query };
|
|
71
66
|
query[filterQuery] = value;
|
|
72
67
|
// eslint-disable-next-line consistent-return
|
|
73
|
-
return
|
|
74
|
-
name:
|
|
68
|
+
return context.state.router.replace({
|
|
69
|
+
name: context.state.router.currentRoute.value.name,
|
|
75
70
|
query,
|
|
76
71
|
});
|
|
77
72
|
},
|