mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 09:56:17 -05:00
Returning download response.
This commit is contained in:
parent
59c4ab2502
commit
863f26b519
3 changed files with 5 additions and 10 deletions
|
|
@ -37,6 +37,7 @@ async function apiCall(url, method, body, ms = 60_000) {
|
|||
// Request encountered an error.
|
||||
let copy = response.clone();
|
||||
const content = await copy.json();
|
||||
console.debug('API error response json', content);
|
||||
const code = content['code'];
|
||||
if (response.status === 403 && code === 'WROL_MODE_ENABLED') {
|
||||
toast({
|
||||
|
|
@ -463,11 +464,7 @@ export async function postDownload(urls, downloader, frequency, sub_downloader,
|
|||
body['tag_names'] = tagNames;
|
||||
}
|
||||
let response = await apiPost(`${API_URI}/download`, body);
|
||||
if (response.status !== 204) {
|
||||
const content = await response.json();
|
||||
console.error(content);
|
||||
throw Error(content['error']);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function killDownload(download_id) {
|
||||
|
|
|
|||
|
|
@ -1295,7 +1295,7 @@ export function useAPIButton(
|
|||
// Create button with or without theme. Pass all props to the <Button/> (except props.children).
|
||||
const buttonArgs = {color, onClick: localOnClick, disabled, loading: pending, size, floated, ...props};
|
||||
|
||||
let buttonContent = <>{props.children}</>;
|
||||
let buttonContent = props.children || null;
|
||||
if (icon) {
|
||||
// Send Icon as Button properties.
|
||||
buttonContent = null;
|
||||
|
|
|
|||
|
|
@ -179,8 +179,7 @@ class ChannelDownload extends React.Component {
|
|||
this.setState({frequency: value, success: false});
|
||||
}
|
||||
|
||||
handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
handleSubmit = async () => {
|
||||
this.setState({disabled: true, pending: true, success: null, error: null});
|
||||
const {url, frequency} = this.state;
|
||||
if (!url) {
|
||||
|
|
@ -289,8 +288,7 @@ class RSSDownload extends ChannelDownload {
|
|||
this.setState({[name]: value});
|
||||
}
|
||||
|
||||
handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
handleSubmit = async () => {
|
||||
this.setState({disabled: true, pending: true, success: null, error: null});
|
||||
const {url, frequency, sub_downloader, excludedURLs} = this.state;
|
||||
if (!url) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue