Updated background endpoint
This commit is contained in:
13
server.cjs
13
server.cjs
@@ -550,9 +550,20 @@ app.post(
|
||||
);
|
||||
|
||||
app.delete("/trigger/api/backgrounds", async (req, res) => {
|
||||
fs.rm(`../TriggerFrontend/backgrounds/${req.body.background}`, (_err) => {
|
||||
fs.rm(`../TriggerFrontend/backgrounds/${req.body.fileName}`, (_err) => {
|
||||
res.status(200).send({ status: "success" });
|
||||
});
|
||||
const conn = await pool.getConnection();
|
||||
const query = `UPDATE trigger_database.themes SET backgroundImage = 'none' WHERE backgroundImage = ${escapeString(req.body.fileName)};`;
|
||||
conn
|
||||
.query(query)
|
||||
.then((_rows) => {
|
||||
console.log("success");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
conn.end();
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user