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 [searchTerm, setSearchTerm] = useQuery("q", " ", true, false);
const [searchTerm, setSearchTerm] = useQuery("q", "", true, false);
const [entryId, setEntryId] = useState();

Wyświetl plik

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