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