mirror of
https://github.com/YouHaveTrouble/DiscipleOfLand.git
synced 2026-05-12 06:26:56 +00:00
better default filters
This commit is contained in:
@@ -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
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user