appstore and support: async'ify
This commit is contained in:
+8
-10
@@ -55,7 +55,7 @@ function getCloudronName(req, res, next) {
|
||||
});
|
||||
}
|
||||
|
||||
function setAppstoreListingConfig(req, res, next) {
|
||||
async function setAppstoreListingConfig(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
const listingConfig = _.pick(req.body, 'whitelist', 'blacklist');
|
||||
@@ -73,19 +73,17 @@ function setAppstoreListingConfig(req, res, next) {
|
||||
if (!listingConfig.blacklist.every(id => typeof id === 'string')) return next(new HttpError(400, 'blacklist must be array of strings'));
|
||||
}
|
||||
|
||||
settings.setAppstoreListingConfig(listingConfig, function (error) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
const [error] = await safe(settings.setAppstoreListingConfig(listingConfig));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(202, {}));
|
||||
});
|
||||
next(new HttpSuccess(202, {}));
|
||||
}
|
||||
|
||||
function getAppstoreListingConfig(req, res, next) {
|
||||
settings.getAppstoreListingConfig(function (error, listingConfig) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
async function getAppstoreListingConfig(req, res, next) {
|
||||
const [error, listingConfig] = await safe(settings.getAppstoreListingConfig());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, listingConfig));
|
||||
});
|
||||
next(new HttpSuccess(200, listingConfig));
|
||||
}
|
||||
|
||||
async function setCloudronAvatar(req, res, next) {
|
||||
|
||||
Reference in New Issue
Block a user