Skip to content

Commit

Permalink
potential fix in decline, attempt to resolve promise hell in requestT…
Browse files Browse the repository at this point in the history
…ransfer
  • Loading branch information
suculent committed Nov 15, 2023
1 parent dce890a commit 4319111
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/router.transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ module.exports = function (app) {
}

async function requestTransfer(req, res) {
if (!Util.validateSession(req)) return res.status(401).end();
if (!Util.validateSession(req)) return Promise.resolve(res.status(401).end());
let owner = sanitka.owner(req.session.owner);

let response = await transfer.request(owner, req.body).catch( (error) => {
console.log("[transferResultRedirect] in error", error);
return transferResultRedirect(false, res, error);
return Promise.resolve(transferResultRedirect(false, res, error));
});

console.log("[transferResultRedirect] with response", response);
transferResultRedirect(true, res, response);
return Promise.resolve(transferResultRedirect(true, res, response));
}

async function getDeclineTransfer(req, res) {
Expand Down Expand Up @@ -69,7 +69,7 @@ module.exports = function (app) {
udids: sanitka.udid(req.body.udid)
};

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

Expand Down

0 comments on commit 4319111

Please sign in to comment.