mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 18:58:30 +02:00
Add search autocomplete (#53)
* Implement search autocomplete for recent searches * Implement search autocomplete for bookmarks * Fix URL encoding of query param * Add tag suggestions to search autocomplete Co-authored-by: Sascha Ißbrücker <sissbruecker@lyska.io>
This commit is contained in:
14
bookmarks/components/api.js
Normal file
14
bookmarks/components/api.js
Normal file
@@ -0,0 +1,14 @@
|
||||
export class ApiClient {
|
||||
constructor(baseUrl) {
|
||||
this.baseUrl = baseUrl
|
||||
}
|
||||
|
||||
getBookmarks(query, options = {limit: 100, offset: 0}) {
|
||||
const encodedQuery = encodeURIComponent(query)
|
||||
const url = `${this.baseUrl}bookmarks?q=${encodedQuery}&limit=${options.limit}&offset=${options.offset}`
|
||||
|
||||
return fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(data => data.results)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user