Fixed an async issue

This commit is contained in:
ION606
2022-07-31 10:06:36 +03:00
parent 47b0040f62
commit e1c028789a
+2 -2
View File
@@ -142,13 +142,13 @@ app.post('/sendData', async (req, res) => {
try {
const pref = JSON.parse(req.headers.serversettings);
connection.then((client) => {
connection.then(async (client) => {
const dbo = client.db(pref.Id).collection('SETUP');
await dbo.updateOne({ _id: 'WELCOME' }, {$set: { welcomechannel: pref.WELCOME.welcomechannel, welcomemessage: pref.WELCOME.welcomemessage }});
await dbo.updateOne({ _id: 'LOG' }, {$set: { keepLogs: pref.LOG.keepLogs, logchannel: pref.LOG.logchannel, severity: pref.LOG.severity }});
}).then(() => { res.send("DONE"); })
} catch (err) {
console.error(err);
res.send("FAILED");