better default filters

This commit is contained in:
2024-07-15 18:51:01 +02:00
parent 7629c9f339
commit 592f941a1c
2 changed files with 8 additions and 5 deletions
+6 -3
View File
@@ -70,9 +70,13 @@ export default defineComponent(
}, },
filterNodes(nodes: Node[] = []) { filterNodes(nodes: Node[] = []) {
let filters: Filters | null = null; let filters: Filters | null = null;
const filtersString = window.localStorage.getItem("filters"); let filtersString = window.localStorage.getItem("filters");
if (filtersString === null) { if (filtersString === null) {
this.displayNodes = this.nodes; window.localStorage.setItem("filters", JSON.stringify(new Filters()));
filtersString = window.localStorage.getItem("filters");
}
if (filtersString === null) {
console.error("Failed to get filters from local storage!");
return; return;
} }
const parsedFilters = JSON.parse(filtersString); const parsedFilters = JSON.parse(filtersString);
@@ -98,7 +102,6 @@ export default defineComponent(
}, },
mounted() { mounted() {
this.filterNodes(this.nodes); this.filterNodes(this.nodes);
}, },
} }
); );
+2 -2
View File
@@ -13,9 +13,9 @@ export default class Filters {
jobs?: string[], jobs?: string[],
}, },
) { ) {
this.minLevel = data?.minLevel || 1; this.minLevel = data?.minLevel || 91;
this.maxLevel = data?.maxLevel || 100; this.maxLevel = data?.maxLevel || 100;
const jobData = data?.jobs || []; const jobData = data?.jobs || [Job.BOTANIST, Job.MINER];
for (const job of jobData) { for (const job of jobData) {
const parsedJob = jobFromString(job); const parsedJob = jobFromString(job);