mirror of
https://github.com/TeamPiped/Piped.git
synced 2026-04-03 06:16:59 +00:00
add search history
This commit is contained in:
@@ -47,11 +47,15 @@ export default {
|
||||
}
|
||||
},
|
||||
async refreshSuggestions() {
|
||||
this.searchSuggestions = (
|
||||
await this.fetchJson(this.apiUrl() + "/opensearch/suggestions", {
|
||||
query: this.searchText,
|
||||
})
|
||||
)?.[1];
|
||||
if (!this.searchText) {
|
||||
this.searchSuggestions = JSON.parse(localStorage.getItem("search_history")) ?? [];
|
||||
} else {
|
||||
this.searchSuggestions = (
|
||||
await this.fetchJson(this.apiUrl() + "/opensearch/suggestions", {
|
||||
query: this.searchText,
|
||||
})
|
||||
)?.[1];
|
||||
}
|
||||
this.searchSuggestions.unshift(this.searchText);
|
||||
this.setSelected(0);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user