mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Fixing failed api requests.
This commit is contained in:
parent
3673092847
commit
e5b2135cb2
2 changed files with 4 additions and 6 deletions
|
|
@ -111,7 +111,7 @@ export async function deleteChannel(id) {
|
|||
|
||||
export async function getChannels() {
|
||||
let response = await apiGet(`${VIDEOS_API}/channels`);
|
||||
if (response.stack === 200) {
|
||||
if (response.status === 200) {
|
||||
return (await response.json())['channels'];
|
||||
} else {
|
||||
toast({
|
||||
|
|
@ -185,7 +185,7 @@ export async function getDirectories(search_str) {
|
|||
|
||||
export async function getSettings() {
|
||||
let response = await apiGet(`${API_URI}/settings`);
|
||||
if (response === 200) {
|
||||
if (response.status === 200) {
|
||||
return await response.json();
|
||||
} else {
|
||||
toast({
|
||||
|
|
|
|||
|
|
@ -306,15 +306,13 @@ class Videos extends React.Component {
|
|||
// Pass any enabled filters to the search.
|
||||
let filtersArr = this.enabledFilters();
|
||||
|
||||
let videos = [];
|
||||
let total = 0;
|
||||
try {
|
||||
let [videos, total] = await searchVideos(offset, limit, channel_id, queryStr, searchOrder, filtersArr);
|
||||
let totalPages = Math.round(total / this.state.limit) || 1;
|
||||
this.setState({videos, totalPages});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
let totalPages = Math.round(total / this.state.limit) || 1;
|
||||
this.setState({videos, totalPages});
|
||||
}
|
||||
|
||||
changePage = async (activePage) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue