mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-05-05 11:10:43 +08:00
fix(api): change param hashes to hash (#112)
This commit is contained in:
19
src/Api.ts
19
src/Api.ts
@@ -174,13 +174,7 @@ class Api {
|
||||
}
|
||||
|
||||
public getTorrentTracker(hash: string) {
|
||||
const params = {
|
||||
hash,
|
||||
};
|
||||
|
||||
return this.axios.get('/torrents/trackers', {
|
||||
params,
|
||||
}).then(Api.handleResponse);
|
||||
return this.actionTorrent('trackers', hash);
|
||||
}
|
||||
|
||||
public getTorrentPeers(hash: string, rid?: number) {
|
||||
@@ -195,7 +189,7 @@ class Api {
|
||||
}
|
||||
|
||||
public editTracker(hash: string, origUrl: string, newUrl: string) {
|
||||
return this.actionTorrents('editTracker', [hash], { origUrl, newUrl });
|
||||
return this.actionTorrent('editTracker', hash, { origUrl, newUrl });
|
||||
}
|
||||
|
||||
public setTorrentLocation(hashes: string[], location: string) {
|
||||
@@ -351,6 +345,15 @@ class Api {
|
||||
return this.axios.post('/search/enablePlugin', body).then(Api.handleResponse);
|
||||
}
|
||||
|
||||
private actionTorrent(action: string, hash: string, extra?: any) {
|
||||
const params: any = {
|
||||
hash,
|
||||
...extra,
|
||||
};
|
||||
const data = new URLSearchParams(params);
|
||||
return this.axios.post(`/torrents/${action}`, data).then(Api.handleResponse);
|
||||
}
|
||||
|
||||
private actionTorrents(action: string, hashes: string[], extra?: any) {
|
||||
const params: any = {
|
||||
hashes: hashes.join('|'),
|
||||
|
||||
Reference in New Issue
Block a user