Make optional fields optional (#154)

This fixes an issue that required people to manually specify a timeout
and wait for their tasks when they're created.
This commit is contained in:
Rowan Manning
2016-11-07 14:06:12 +00:00
committed by GitHub
parent 2976d5e391
commit c562bb07f3
3 changed files with 12 additions and 6 deletions

View File

@@ -13,6 +13,8 @@
// You should have received a copy of the GNU General Public License
// along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
/*jshint maxcomplexity:8*/
'use strict';
const presentTask = require('../../view/presenter/task');
@@ -55,6 +57,10 @@ function route(app) {
return next();
}
req.body.ignore = req.body.ignore || [];
req.body.timeout = req.body.timeout || undefined;
req.body.wait = req.body.wait || undefined;
req.body.username = req.body.username || undefined;
req.body.password = req.body.password || undefined;
app.webservice.task(req.params.id).edit(req.body, err => {
if (err) {
task.name = req.body.name;