crash fixes

This commit is contained in:
Girish Ramakrishnan
2023-08-17 13:02:36 +05:30
parent 3d0ba557e5
commit 5c98b6f080
5 changed files with 26 additions and 14 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ exports = module.exports = {
getConfig,
startPrepareLocation,
setupLocation
changeLocation
};
const AuditSource = require('../auditsource.js'),
@@ -31,10 +31,10 @@ async function startPrepareLocation(req, res, next) {
next(new HttpSuccess(202, { taskId }));
}
async function setupLocation(req, res, next) {
async function changeLocation(req, res, next) {
if (!req.body.domain || typeof req.body.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
const [error] = await safe(dashboard.setupLocation(constants.DASHBOARD_SUBDOMAIN, req.body.domain, AuditSource.fromRequest(req)));
const [error] = await safe(dashboard.changeLocation(constants.DASHBOARD_SUBDOMAIN, req.body.domain, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(204, {}));