@paris-ias/list 1.0.65 → 1.0.67
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/dist/module.json
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
icon
|
|
10
10
|
class="ml-auto"
|
|
11
11
|
v-bind="tooltip"
|
|
12
|
-
@click="
|
|
12
|
+
@click="
|
|
13
|
+
() => {
|
|
14
|
+
rootStore.resetState(type);
|
|
15
|
+
rootStore.update(type);
|
|
16
|
+
}
|
|
17
|
+
"
|
|
13
18
|
>
|
|
14
19
|
<v-icon>mdi-restore</v-icon>
|
|
15
20
|
</v-btn>
|
|
@@ -32,6 +37,5 @@ const props = defineProps({
|
|
|
32
37
|
});
|
|
33
38
|
onMounted(() => {
|
|
34
39
|
console.log("store module", $stores[props.type]);
|
|
35
|
-
rootStore.loadFiltersFromLocalStorage(props.type);
|
|
36
40
|
});
|
|
37
41
|
</script>
|
|
@@ -5,8 +5,6 @@ export declare const useRootStore: import("pinia").StoreDefinition<"rootStore",
|
|
|
5
5
|
loadRouteQuery(type: string): void;
|
|
6
6
|
loadFiltersFromLocalStorage(type: string): void;
|
|
7
7
|
setFiltersCount(type: string): void;
|
|
8
|
-
setBlankFilterLoad(type: string): void;
|
|
9
|
-
setDefaults(): void;
|
|
10
8
|
updateRouteQuery(type: string): void;
|
|
11
9
|
resetState(type: string): void;
|
|
12
10
|
updateSort({ value, type }: {
|
|
@@ -83,11 +83,6 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
83
83
|
}, 0);
|
|
84
84
|
$stores[type].filtersCount = count;
|
|
85
85
|
},
|
|
86
|
-
setBlankFilterLoad(type) {
|
|
87
|
-
},
|
|
88
|
-
setDefaults() {
|
|
89
|
-
const lang = localStorage.getItem("lang");
|
|
90
|
-
},
|
|
91
86
|
updateRouteQuery(type) {
|
|
92
87
|
const router = useRouter();
|
|
93
88
|
const { $stores } = useNuxtApp();
|
|
@@ -113,6 +108,7 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
113
108
|
resetState(type) {
|
|
114
109
|
const { $stores, $models } = useNuxtApp();
|
|
115
110
|
console.log("$models[type]: ", $models[type]);
|
|
111
|
+
const store = $stores[type];
|
|
116
112
|
$stores[type] = $models[type];
|
|
117
113
|
console.log("resetState");
|
|
118
114
|
this.search = "";
|
|
@@ -177,7 +173,7 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
177
173
|
await this.update(type, lang);
|
|
178
174
|
},
|
|
179
175
|
async update(type, lang = "en") {
|
|
180
|
-
const { $stores } = useNuxtApp();
|
|
176
|
+
const { $stores, $queries } = useNuxtApp();
|
|
181
177
|
this.setLoading(true);
|
|
182
178
|
if (type !== "all") {
|
|
183
179
|
$stores[type].loading = true;
|
|
@@ -216,11 +212,11 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
216
212
|
let result = {};
|
|
217
213
|
console.log("args: ", args);
|
|
218
214
|
console.log(`Fetching ${type}`);
|
|
219
|
-
const { $queries } = useNuxtApp();
|
|
220
215
|
const { data, error } = await useAsyncQuery(
|
|
221
216
|
type === "all" ? SEARCH : $queries[type].list,
|
|
222
217
|
args
|
|
223
218
|
);
|
|
219
|
+
console.log("data: ", data);
|
|
224
220
|
if (error.value) console.log(error.value);
|
|
225
221
|
const key = type === "all" ? "search" : "list" + type.charAt(0).toUpperCase() + type.slice(1);
|
|
226
222
|
if (type === "all") {
|
|
@@ -238,7 +234,6 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
238
234
|
$stores[type].items = result["items"];
|
|
239
235
|
const lastPage = Math.ceil(result.total / itemsPerPage);
|
|
240
236
|
this.setFiltersCount(type);
|
|
241
|
-
this.setBlankFilterLoad(type);
|
|
242
237
|
$stores[type].numberOfPages = lastPage;
|
|
243
238
|
}
|
|
244
239
|
this.setLoading(false, type);
|