From ff912cb73360049242347b7cd646f9953b0f129d Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Sat, 3 Oct 2020 00:10:17 +0800 Subject: [PATCH] API: rename /add to /add-urls To make things clearer. --- client/src/javascript/actions/TorrentActions.ts | 2 +- server/routes/api/torrents.ts | 4 ++-- shared/types/Action.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/javascript/actions/TorrentActions.ts b/client/src/javascript/actions/TorrentActions.ts index 973e63f9..2b6924f7 100644 --- a/client/src/javascript/actions/TorrentActions.ts +++ b/client/src/javascript/actions/TorrentActions.ts @@ -19,7 +19,7 @@ const baseURI = ConfigStore.getBaseURI(); const TorrentActions = { addTorrentsByUrls: (options: AddTorrentByURLOptions) => axios - .post(`${baseURI}api/torrents/add`, options) + .post(`${baseURI}api/torrents/add-urls`, options) .then((json) => json.data) .then( (response) => { diff --git a/server/routes/api/torrents.ts b/server/routes/api/torrents.ts index f72b4c3a..0b07b51f 100644 --- a/server/routes/api/torrents.ts +++ b/server/routes/api/torrents.ts @@ -17,7 +17,7 @@ import mediainfo from '../../util/mediainfo'; const router = express.Router(); /** - * POST /api/torrents/add + * POST /api/torrents/add-urls * @summary Adds torrents by URLs. * @tags Torrents * @security AuthenticatedUser @@ -25,7 +25,7 @@ const router = express.Router(); * @return {object} 200 - success response - application/json * @return {Error} 500 - failure response - application/json */ -router.post('/add', (req, res) => { +router.post('/add-urls', (req, res) => { client.addUrls(req.user, req.services, req.body, ajaxUtil.getResponseFn(res)); }); diff --git a/shared/types/Action.ts b/shared/types/Action.ts index 680f3fda..bae253ac 100644 --- a/shared/types/Action.ts +++ b/shared/types/Action.ts @@ -1,6 +1,6 @@ import {TorrentProperties} from './Torrent'; -// POST /api/torrents/add +// POST /api/torrents/add-urls export interface AddTorrentByURLOptions { // URLs to download torrents from urls: Array;