Loading files
b841128f4This file is pinned to the selected release. Download the original to open it in your design tool.
import { ERR_INTERNAL_SERVER_ERROR } from "../constants";
import config from "../services/configstore";
const CONFIG_KEY = "maintenance";
const getMaintenance = () => {
const maintenance = config.get(CONFIG_KEY, { tasks: [] });
return maintenance;
};
export const fetch = (req, res) => {
const maintenance = getMaintenance();
res.send(maintenance);
};
export const update = (req, res) => {
const maintenance = req.body;
try {
config.set(CONFIG_KEY, maintenance);
res.send({ message: "maintenance tasks saved" });
} catch (err) {
res.status(ERR_INTERNAL_SERVER_ERROR).send({
msg: "Failed to save settings" + JSON.stringify(maintenance.rcfile),
});
}
};