kopia lustrzana https://github.com/bugout-dev/moonstream
Merge pull request #104 from zomglings/fix-stream-query
Fixed issues with stream requests to backendpull/99/head^2
commit
a5ba0bf514
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue