Merge pull request #104 from zomglings/fix-stream-query

Fixed issues with stream requests to backend
pull/99/head^2
Neeraj Kashyap 2021-08-13 08:51:30 -07:00 zatwierdzone przez GitHub
commit a5ba0bf514
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 11 dodań i 17 usunięć

Wyświetl plik

@ -28,7 +28,7 @@ const UIProvider = ({ children }) => {
}); });
const { modal, toggleModal } = useContext(ModalContext); const { modal, toggleModal } = useContext(ModalContext);
const [searchTerm, setSearchTerm] = useQuery("q", " ", true, false); const [searchTerm, setSearchTerm] = useQuery("q", "", true, false);
const [entryId, setEntryId] = useState(); const [entryId, setEntryId] = useState();

Wyświetl plik

@ -10,31 +10,25 @@ export const getStream = ({
include_start, include_start,
include_end, include_end,
}) => { }) => {
let params = {}; let params = {
q: searchTerm,
if (searchTerm) { };
params.q = encodeURIComponent(searchTerm); if (start_time || start_time === 0) {
params.start_time = start_time;
} }
if (end_time || end_time === 0) {
if (start_time) { params.end_time = end_time;
params.start_time = encodeURIComponent(start_time);
} }
if (end_time) {
params.end_time = encodeURIComponent(end_time);
}
if (include_start) { if (include_start) {
params.include_start = encodeURIComponent(true); params.include_start = include_start;
} }
if (include_end) { if (include_end) {
params.include_end = encodeURIComponent(true); params.include_end = include_end;
} }
return http({ return http({
method: "GET", method: "GET",
url: `${API}/streams/`, url: `${API}/streams/`,
params: params, params,
}); });
}; };