-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmitRetract.js
More file actions
30 lines (26 loc) · 883 Bytes
/
Copy pathsubmitRetract.js
File metadata and controls
30 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const axios = require("axios");
const servicehelper = require("./utils/ServiceHelper");
const qh = require("./utils/QueueHelper");
const ACTION = 'retract';
//Post Iri to be retracted to Portal
const toPortal = ({iri, action}) => {
console.log(" IN: toPortal (Retract)");
const retractPkgApi = servicehelper.getApi("portalQProc", "retractPkg");
const {url, method} = retractPkgApi;
const data = {iri, action};
axios({
method: method,
url: url,
data: {data}
})
.then(res => {
(res.data.success)
? qh.publishStatus(qh.formMsg(iri, 'under_retraction', res.data.success.message, ACTION))
: qh.publishStatus(qh.formMsg(iri, 'failed', res.data.error.message, ACTION))
})
.catch((err) => {
qh.publishStatus(qh.formMsg(iri, 'failed', 'Error on Editor Q Processor', ACTION));
console.log(err);
});
};
module.exports.toPortal = toPortal;