mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-12 05:49:17 +00:00
feat: improve search matching (#800)
* offload search to lunr.js * update location search when locations are mutated
This commit is contained in:
parent
4c9ddac395
commit
b655cfab28
7 changed files with 71 additions and 44 deletions
|
@ -1,12 +1,13 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { LocationsApi } from "~~/lib/api/classes/locations";
|
||||
import { LocationOutCount } from "~~/lib/api/types/data-contracts";
|
||||
import { LocationOutCount, TreeItem } from "~~/lib/api/types/data-contracts";
|
||||
|
||||
export const useLocationStore = defineStore("locations", {
|
||||
state: () => ({
|
||||
parents: null as LocationOutCount[] | null,
|
||||
Locations: null as LocationOutCount[] | null,
|
||||
client: useUserApi(),
|
||||
tree: null as TreeItem[] | null,
|
||||
}),
|
||||
getters: {
|
||||
/**
|
||||
|
@ -60,5 +61,14 @@ export const useLocationStore = defineStore("locations", {
|
|||
this.Locations = result.data;
|
||||
return result;
|
||||
},
|
||||
async refreshTree(): ReturnType<LocationsApi["getTree"]> {
|
||||
const result = await this.client.locations.getTree();
|
||||
if (result.error) {
|
||||
return result;
|
||||
}
|
||||
|
||||
this.tree = result.data;
|
||||
return result;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue