Inputs a query, page and type and will search the bay for the query and return it as a json objec.t
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
* @Author: KevinMidboe
|
||||
* @Date: 2017-10-21 09:54:31
|
||||
* @Last Modified by: KevinMidboe
|
||||
* @Last Modified time: 2017-10-21 09:58:00
|
||||
* @Last Modified time: 2017-10-21 12:12:26
|
||||
*/
|
||||
|
||||
const PirateRepository = require('src/pirate/pirateRepository');
|
||||
const pirateRepository = new PirateRepository();
|
||||
// const pirateRepository = new PirateRepository();
|
||||
|
||||
/**
|
||||
* Controller: Retrieves search history of a logged in user
|
||||
@@ -15,12 +15,11 @@ const pirateRepository = new PirateRepository();
|
||||
* @returns {Callback}
|
||||
*/
|
||||
function updateRequested(req, res) {
|
||||
const id = req.params.requestName;
|
||||
const type = req.body.type;
|
||||
const { query, page, type } = req.query;
|
||||
|
||||
pirateRepository.search(id, type)
|
||||
.then(() => {
|
||||
res.send({ success: true });
|
||||
PirateRepository.SearchPiratebay(query, page, type)
|
||||
.then((result) => {
|
||||
res.send({ success: true, torrents: result });
|
||||
})
|
||||
.catch((error) => {
|
||||
res.status(401).send({ success: false, error: error.message });
|
||||
|
||||
Reference in New Issue
Block a user