feat: release browser lock and await setup

This commit is contained in:
Anton Voylenko 2024-12-03 01:17:47 +02:00
commit fdd32f8474
5 changed files with 29 additions and 11 deletions

View file

@ -43,11 +43,11 @@ const localCallbackExample = async (req, res) => {
try {
const { dataType, data } = req.body
if (dataType === 'qr') { qrcode.generate(data.qr, { small: true }) }
await fsp.writeFile(`${sessionFolderPath}/message_log.txt`, `${JSON.stringify(req.body)}\r\n`, { flag: 'a+' }, _ => _)
await fsp.mkdir(sessionFolderPath, { recursive: true })
await fsp.writeFile(`${sessionFolderPath}/message_log.txt`, `${JSON.stringify(req.body)}\r\n`, { flag: 'a+' })
res.json({ success: true })
} catch (error) {
console.log(error)
await fsp.writeFile(`${sessionFolderPath}/message_log.txt`, `(ERROR) ${JSON.stringify(error)}\r\n`, { flag: 'a+' }, _ => _)
sendErrorResponse(res, 500, error.message)
}
}