refresh config on every response
This commit is contained in:
parent
e6b64b340e
commit
38c4a6a644
@ -37,13 +37,19 @@ app.get('/', (req, res) => {
|
|||||||
app.post('/', (req, response) => {
|
app.post('/', (req, response) => {
|
||||||
if (req.body.start != undefined) {
|
if (req.body.start != undefined) {
|
||||||
fn.commands.startup();
|
fn.commands.startup();
|
||||||
response.render('index', { config: JSON.stringify(config) });
|
fn.commands.refreshConfig().then(res => {
|
||||||
return;
|
config = res.config;
|
||||||
|
response.render('index', { config: JSON.stringify(config) });
|
||||||
|
return;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (req.body.shutdown != undefined) {
|
if (req.body.shutdown != undefined) {
|
||||||
fn.commands.shutdown();
|
fn.commands.shutdown();
|
||||||
response.render('index', { config: JSON.stringify(config) });
|
fn.commands.refreshConfig().then(res => {
|
||||||
return;
|
config = res.config;
|
||||||
|
response.render('index', { config: JSON.stringify(config) });
|
||||||
|
return;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (req.body.reload != undefined) {
|
if (req.body.reload != undefined) {
|
||||||
const updateAugerOffIntervalQuery = `UPDATE intervals SET value = '${2000 - req.body.feedRate}' WHERE key = 'auger_off'`;
|
const updateAugerOffIntervalQuery = `UPDATE intervals SET value = '${2000 - req.body.feedRate}' WHERE key = 'auger_off'`;
|
||||||
@ -62,8 +68,11 @@ app.post('/', (req, response) => {
|
|||||||
}
|
}
|
||||||
if (req.body.quit != undefined) {
|
if (req.body.quit != undefined) {
|
||||||
fn.commands.quit();
|
fn.commands.quit();
|
||||||
response.render('index', { config: JSON.stringify(config) });
|
fn.commands.refreshConfig().then(res => {
|
||||||
return;
|
config = res.config;
|
||||||
|
response.render('index', { config: JSON.stringify(config) });
|
||||||
|
return;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user