Possibility to change selected files after the fact
This commit is contained in:
parent
feae1789a9
commit
86d9d2c5f0
11 changed files with 186 additions and 52 deletions
|
|
@ -16,17 +16,26 @@ const apiUrl =
|
|||
const makeRequest = async (
|
||||
method: string,
|
||||
path: string,
|
||||
data?: any
|
||||
data?: any,
|
||||
isJson?: boolean,
|
||||
): Promise<any> => {
|
||||
console.log(method, path);
|
||||
const url = apiUrl + path;
|
||||
const options: RequestInit = {
|
||||
let options: RequestInit = {
|
||||
method,
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
body: data,
|
||||
};
|
||||
if (isJson) {
|
||||
options.headers = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
options.body = JSON.stringify(data);
|
||||
} else {
|
||||
options.body = data;
|
||||
}
|
||||
|
||||
let error: ErrorDetails = {
|
||||
method: method,
|
||||
|
|
@ -100,6 +109,18 @@ export const API: RqbitAPI & { getVersion: () => Promise<string> } = {
|
|||
return makeRequest("POST", url, data);
|
||||
},
|
||||
|
||||
updateOnlyFiles: (index: number, files: number[]): Promise<void> => {
|
||||
let url = `/torrents/${index}/update_only_files`;
|
||||
return makeRequest(
|
||||
"POST",
|
||||
url,
|
||||
{
|
||||
only_files: files,
|
||||
},
|
||||
true,
|
||||
);
|
||||
},
|
||||
|
||||
pause: (index: number): Promise<void> => {
|
||||
return makeRequest("POST", `/torrents/${index}/pause`);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue