Use POST for search history

This commit is contained in:
Brahim Hadriche committed 2024-01-26 15:52:36 -05:00
1 parent d9b8aaa222
commit e0cf59d90f
5 files changed
+6 -7

No files matched your search

+1 -1
View File
@@ -106,7 +106,7 @@ paths:
type: array
items:
type: string
put:
post:
summary: Add to search history
description: |
Add a query to the search history.
+1 -1
View File
@@ -45,7 +45,7 @@ function Main(args as object) as void
input = CreateObject("roInput")
input.setMessagePort(port)
' TODO:P1 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
' TODO:P2 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
' https://community.roku.com/t5/Roku-Developer-Program/BUG-roSystemLog-not-firing-with-ComponentLibrary/td-p/906075
systemLog = CreateObject("roSystemLog")
systemLog.SetMessagePort(port)
@@ -18,8 +18,7 @@ namespace Http
return true
end function
' TODO:P1 should be POST
@put("/api/search-history")
@post("/api/search-history")
function AddSearchHistory(context as object) as boolean
request = context.request
response = context.response
+2 -2
View File
@@ -111,8 +111,8 @@ export class PlayletApi {
return await response.json();
}
static async putSearchHistory(query: string) {
const response = await PlayletApi.putJson(`${PlayletApi.host()}/api/search-history`, { query });
static async addSearchHistory(query: string) {
const response = await PlayletApi.postJson(`${PlayletApi.host()}/api/search-history`, { query });
return await response.json();
}
@@ -104,7 +104,7 @@
}
if (page === 1) {
const newSearchHistory = await PlayletApi.putSearchHistory(searchBoxText);
const newSearchHistory = await PlayletApi.addSearchHistory(searchBoxText);
searchHistoryStore.set(newSearchHistory);
}
}