mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-05-26 10:32:21 +02:00
fix: missing await on Node fs.writeFile() method
This commit is contained in:
parent
1f2711ee88
commit
182b2821e9
|
@ -59,9 +59,13 @@ export default async function handler(req, res) {
|
|||
//Stringify the new users list
|
||||
newUsersList = JSON.stringify(newUsersList);
|
||||
//Write the new JSON
|
||||
fs.writeFile(jsonDirectory + '/users.json', newUsersList, (err) => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
await fs.writeFile(
|
||||
jsonDirectory + '/users.json',
|
||||
newUsersList,
|
||||
(err) => {
|
||||
if (err) console.log(err);
|
||||
}
|
||||
);
|
||||
res.status(200).json({ message: 'Successful API send' });
|
||||
} catch (error) {
|
||||
//Log for backend
|
||||
|
|
Loading…
Reference in a new issue