mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-04 08:40:28 +00:00
add new query parameter
This commit is contained in:
parent
f8cf62381e
commit
bbd09a6f0a
2 changed files with 8 additions and 1 deletions
|
@ -10,13 +10,19 @@ export function useItemSearch(client: UserClient, opts?: SearchOptions) {
|
||||||
const locations = ref<LocationSummary[]>([]);
|
const locations = ref<LocationSummary[]>([]);
|
||||||
const labels = ref<LabelSummary[]>([]);
|
const labels = ref<LabelSummary[]>([]);
|
||||||
const results = ref<ItemSummary[]>([]);
|
const results = ref<ItemSummary[]>([]);
|
||||||
|
const includeArchived = ref(false);
|
||||||
|
|
||||||
watchDebounced(query, search, { debounce: 250, maxWait: 1000 });
|
watchDebounced(query, search, { debounce: 250, maxWait: 1000 });
|
||||||
async function search() {
|
async function search() {
|
||||||
const locIds = locations.value.map(l => l.id);
|
const locIds = locations.value.map(l => l.id);
|
||||||
const labelIds = labels.value.map(l => l.id);
|
const labelIds = labels.value.map(l => l.id);
|
||||||
|
|
||||||
const { data, error } = await client.items.getAll({ q: query.value, locations: locIds, labels: labelIds });
|
const { data, error } = await client.items.getAll({
|
||||||
|
q: query.value,
|
||||||
|
locations: locIds,
|
||||||
|
labels: labelIds,
|
||||||
|
includeArchived: includeArchived.value,
|
||||||
|
});
|
||||||
if (error) {
|
if (error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
import { AttachmentTypes, PaginationResult } from "../types/non-generated";
|
import { AttachmentTypes, PaginationResult } from "../types/non-generated";
|
||||||
|
|
||||||
export type ItemsQuery = {
|
export type ItemsQuery = {
|
||||||
|
includeArchived?: boolean;
|
||||||
page?: number;
|
page?: number;
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
locations?: string[];
|
locations?: string[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue