Fix dashboard config not getting generated

This commit is contained in:
Girish Ramakrishnan
2023-08-13 21:36:56 +05:30
parent a7be30a816
commit 2b53ea0260
4 changed files with 15 additions and 13 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ exports = module.exports = {
getConfig,
prepareLocation,
changeLocation
setupLocation
};
const AuditSource = require('../auditsource.js'),
@@ -30,10 +30,10 @@ async function prepareLocation(req, res, next) {
next(new HttpSuccess(202, { taskId }));
}
async function changeLocation(req, res, next) {
async function setupLocation(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.changeLocation(req.body.domain, AuditSource.fromRequest(req)));
const [error] = await safe(dashboard.setupLocation(req.body.domain, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(204, {}));