refactor: make a single call to set widgets per template
parent
80f9963bed
commit
8750ee04a6
@ -1,14 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const async = require('async');
|
|
||||||
const widgets = require('../../widgets');
|
const widgets = require('../../widgets');
|
||||||
|
|
||||||
const Widgets = module.exports;
|
const Widgets = module.exports;
|
||||||
|
|
||||||
Widgets.set = function (socket, data, callback) {
|
Widgets.set = async function (socket, data) {
|
||||||
if (!Array.isArray(data)) {
|
if (!Array.isArray(data)) {
|
||||||
return callback(new Error('[[error:invalid-data]]'));
|
throw new Error('[[error:invalid-data]]');
|
||||||
}
|
}
|
||||||
|
await widgets.setAreas(data);
|
||||||
async.eachSeries(data, widgets.setArea, callback);
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue