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