refactor: serach function now async which is way faster

This commit is contained in:
pandadev 2025-03-15 17:44:14 +01:00
parent ae878b7203
commit f435a7b20a
No known key found for this signature in database
GPG key ID: C39629DACB8E762F
14 changed files with 203 additions and 106 deletions

View file

@ -14,17 +14,27 @@ export default defineNuxtPlugin(() => {
},
async searchHistory(query: string): Promise<HistoryItem[]> {
return await invoke<HistoryItem[]>("search_history", { query });
try {
return await invoke<HistoryItem[]>("search_history", { query });
} catch (error) {
console.error("Error searching history:", error);
return [];
}
},
async loadHistoryChunk(
offset: number,
limit: number
): Promise<HistoryItem[]> {
return await invoke<HistoryItem[]>("load_history_chunk", {
offset,
limit,
});
try {
return await invoke<HistoryItem[]>("load_history_chunk", {
offset,
limit,
});
} catch (error) {
console.error("Error loading history chunk:", error);
return [];
}
},
async deleteHistoryItem(id: string): Promise<void> {