Reset state and then set newly reset state to web UI

This commit is contained in:
mmcwilliams 2018-02-12 14:57:06 -05:00
parent ec2215ec76
commit 45e427caf9
2 changed files with 3 additions and 5 deletions

View File

@ -168,15 +168,12 @@ web.reset = function () {
} }
fetch('/reset', opts) fetch('/reset', opts)
.then(web.useJson) .then(web.useJson)
.then(web.resetSuccess) .then(setState)
.catch(err => { .catch(err => {
console.error('Error posting to /reset'); console.error('Error posting to /reset');
console.error(err); console.error(err);
}) })
}; };
web.resetSuccess = function (res) {
console.dir(res)
}
web.restart = function () { web.restart = function () {
const opts = { const opts = {
method : 'POST', method : 'POST',

View File

@ -340,7 +340,8 @@ function rReset (req, res, next) {
log.info(`/reset`, {time : +new Date()}) log.info(`/reset`, {time : +new Date()})
intval.reset() intval.reset()
setTimeout(() => { setTimeout(() => {
res.send(intval._state) const obj = intval.status()
res.send(obj)
return next() return next()
}, 10) }, 10)
} }