add new query parameter

This commit is contained in:
Hayden 2022-10-31 21:40:10 -08:00
parent f8cf62381e
commit bbd09a6f0a
No known key found for this signature in database
GPG key ID: 17CF79474E257545
2 changed files with 8 additions and 1 deletions

View file

@ -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;
} }

View file

@ -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[];