Skip to content

Commit

Permalink
from 7 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
suculent committed Nov 15, 2023
1 parent 63b8fb7 commit 2987db8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/router.transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ module.exports = function (app) {
if (!Util.validateSession(req)) return res.status(401).end();
let owner = sanitka.owner(req.session.owner);
const body = req.body;
await transfer.request(owner, body).catch( (error) => {
let response = await transfer.request(owner, body).catch( (error) => {
console.log("[transferResultRedirect] await transfer.request with error", error, "in body", {body});
transferResultRedirect(false, res, error);
}).then((resolve) => {
}).then(() => {
console.log("[transferResultRedirect] with response", response);
transferResultRedirect(true, res, response);
resolve(true);
});
}

Expand All @@ -50,9 +49,8 @@ module.exports = function (app) {

let response = await transfer.decline(body).catch((response) => {
transferResultRedirect(false, res, response);
}).then((resolve) => {
}).then(() => {
transferResultRedirect(true, res, response);
resolve(true);
});
}

Expand All @@ -69,7 +67,6 @@ module.exports = function (app) {
udids: sanitka.udid(req.body.udid)
};

// may throw
await transfer.decline(body).catch((error) => {
transferResultRedirect(false, res, error);
}).then(() => {
Expand All @@ -81,12 +78,12 @@ module.exports = function (app) {

if (!Util.isDefined(req.query.transfer_id)) return Util.responder(res, false, "transfer_id_missing");

await transfer.accept({
let response = await transfer.accept({
transfer_id: req.query.transfer_id,
udids: []
}).catch((error) => {
transferResultRedirect(false, res, error);
}).then((response) => {
}).then(() => {
transferResultRedirect(true, res, response);
});
}
Expand All @@ -105,7 +102,7 @@ module.exports = function (app) {
console.log("🔨 [debug] <postAcceptTransfer> with body: ", {body});

await transfer.accept(body).catch((response) => {
console.log("postAcceptTransfer response", response);
console.log("[debug] postAcceptTransfer response", response);
res.redirect(app_config.public_url + "/error.html?success=failed");
}).then(() => {
res.redirect(app_config.public_url + "/error.html?success=true");
Expand Down

0 comments on commit 2987db8

Please sign in to comment.